title: Node.JS Nodemailer using long HTML
body: <p>I have a problem.
  I'm using Node.JS nodemailer.</p>
  <pre><code>const url = `${url}`;
  var mailOptions = {
  
      from: 'stackoverflow',
      to: email,
      subject: 'test',
      html: 'Please click this email to confirm your email: &lt;a href=&quot;${url}&quot;&gt;${url}&lt;/a&gt;`'
  };
  </code></pre>
  <p>The HTML is quite long. So I would have to link each line with</p>
  <p>'Line1' +</p>
  <p>'Line2' +</p>
  <p>and unfortunately the uplines are shown an error see: align = 'center'</p>
  <p>Is there a way to embed this HTML file simply and easily?
  And if I can include the file separately I have created a variable and this should then be displayed in HTML. How would that work?
  Can I somehow embed the file differently than directly in the code? I appreciate help!</p>
  <p>This is my html</p>
  <pre><code>    &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
      &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
      &lt;head&gt;
        &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
        &lt;title&gt;[SUBJECT]&lt;/title&gt;
        &lt;style type=&quot;text/css&quot;&gt;
        body {
         padding-top: 0 !important;
         padding-bottom: 0 !important;
         padding-top: 0 !important;
         padding-bottom: 0 !important;
         margin:0 !important;
         width: 100% !important;
         -webkit-text-size-adjust: 100% !important;
         -ms-text-size-adjust: 100% !important;
         -webkit-font-smoothing: antialiased !important;
       }
       .tableContent img {
         border: 0 !important;
         display: block !important;
         outline: none !important;
       }
       a{
        color:#382F2E;
      }
  
      p, h1{
        color:#382F2E;
        margin:0;
      }
   p{
        text-align:left;
        color:#999999;
        font-size:14px;
        font-weight:normal;
        line-height:19px;
      }
  
      a.link1{
        color:#382F2E;
      }
      a.link2{
        font-size:16px;
        text-decoration:none;
        color:#ffffff;
      }
  
      h2{
        text-align:left;
         color:#222222; 
         font-size:19px;
        font-weight:normal;
      }
      div,p,ul,h1{
        margin:0;
      }
  
      .bgBody{
        background: #ffffff;
      }
      .bgItem{
        background: #ffffff;
      }
      
  @media only screen and (max-width:480px)
          
  {
          
  table[class=&quot;MainContainer&quot;], td[class=&quot;cell&quot;] 
      {
          width: 100% !important;
          height:auto !important; 
      }
  td[class=&quot;specbundle&quot;] 
      {
          width:100% !important;
          float:left !important;
          font-size:13px !important;
          line-height:17px !important;
          display:block !important;
          padding-bottom:15px !important;
      }
          
  td[class=&quot;spechide&quot;] 
      {
          display:none !important;
      }
          img[class=&quot;banner&quot;] 
      {
                width: 100% !important;
                height: auto !important;
      }
          td[class=&quot;left_pad&quot;] 
      {
              padding-left:15px !important;
              padding-right:15px !important;
      }
           
  }
      
  @media only screen and (max-width:540px) 
  
  {
          
  table[class=&quot;MainContainer&quot;], td[class=&quot;cell&quot;] 
      {
          width: 100% !important;
          height:auto !important; 
      }
  td[class=&quot;specbundle&quot;] 
      {
          width:100% !important;
          float:left !important;
          font-size:13px !important;
          line-height:17px !important;
          display:block !important;
          padding-bottom:15px !important;
      }
          
  td[class=&quot;spechide&quot;] 
      {
          display:none !important;
      }
          img[class=&quot;banner&quot;] 
      {
                width: 100% !important;
                height: auto !important;
      }
      .font {
          font-size:18px !important;
          line-height:22px !important;
          
          }
          .font1 {
          font-size:18px !important;
          line-height:22px !important;
          
          }
  }
  
      &lt;/style&gt;
  &lt;script type=&quot;colorScheme&quot; class=&quot;swatch active&quot;&gt;
  {
      &quot;name&quot;:&quot;Default&quot;,
      &quot;bgBody&quot;:&quot;ffffff&quot;,
      &quot;link&quot;:&quot;382F2E&quot;,
      &quot;color&quot;:&quot;999999&quot;,
      &quot;bgItem&quot;:&quot;ffffff&quot;,
      &quot;title&quot;:&quot;222222&quot;
  }
  &lt;/script&gt;
    &lt;/head&gt;
    &lt;body paddingwidth=&quot;0&quot; paddingheight=&quot;0&quot;   style=&quot;padding-top: 0; padding-bottom: 0; padding-top: 0; padding-bottom: 0; background-repeat: repeat; width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;&quot; offset=&quot;0&quot; toppadding=&quot;0&quot; leftpadding=&quot;0&quot;&gt;
      &lt;table bgcolor=&quot;#ffffff&quot; width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; class=&quot;tableContent&quot; align=&quot;center&quot;  style='font-family:Helvetica, Arial,serif;'&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;table width=&quot;600&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot; bgcolor=&quot;#ffffff&quot; class=&quot;MainContainer&quot;&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign=&quot;top&quot; width=&quot;40&quot;&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td&gt;&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
    &lt;tbody&gt;
    &lt;!-- =============================== Header ====================================== --&gt;   
      &lt;tr&gt;
          &lt;td height='75' class=&quot;spechide&quot;&gt;&lt;/td&gt;
          
          &lt;!-- =============================== Body ====================================== --&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td class='movableContentContainer ' valign='top'&gt;
          &lt;div class=&quot;movableContent&quot; style=&quot;border: 0px; padding-top: 0px; position: relative;&quot;&gt;
              &lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td height=&quot;35&quot;&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign=&quot;top&quot; align=&quot;center&quot; class=&quot;specbundle&quot;&gt;&lt;div class=&quot;contentEditableContainer contentTextEditable&quot;&gt;
                                  &lt;div class=&quot;contentEditable&quot;&gt;
                                    &lt;p style='text-align:center;margin:0;font-family:Georgia,Time,sans-serif;font-size:26px;color:#222222;'&gt;&lt;span class=&quot;specbundle2&quot;&gt;&lt;span class=&quot;font1&quot;&gt;Welcome to&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
                                  &lt;/div&gt;
                                &lt;/div&gt;&lt;/td&gt;
        &lt;td valign=&quot;top&quot; class=&quot;specbundle&quot;&gt;&lt;div class=&quot;contentEditableContainer contentTextEditable&quot;&gt;
                                  &lt;div class=&quot;contentEditable&quot;&gt;
                                    &lt;p style='text-align:center;margin:0;font-family:Georgia,Time,sans-serif;font-size:26px;color:#DC2828;'&gt;&lt;span class=&quot;font&quot;&gt;[CLIENTS.COMPANY_NAME]&lt;/span&gt; &lt;/p&gt;
                                  &lt;/div&gt;
                                &lt;/div&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
          &lt;/div&gt;
          &lt;div class=&quot;movableContent&quot; style=&quot;border: 0px; padding-top: 0px; position: relative;&quot;&gt;
              &lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;&gt;
                            &lt;tr&gt;
                              &lt;td valign='top' align='center'&gt;
                                &lt;div class=&quot;contentEditableContainer contentImageEditable&quot;&gt;
                                  &lt;div class=&quot;contentEditable&quot;&gt;
                                    &lt;img src=&quot;images/line.png&quot; width='251' height='43' alt='' data-default=&quot;placeholder&quot; data-max-width=&quot;560&quot;&gt;
                                  &lt;/div&gt;
                                &lt;/div&gt;
                              &lt;/td&gt;
                            &lt;/tr&gt;
                          &lt;/table&gt;
          &lt;/div&gt;
          &lt;div class=&quot;movableContent&quot; style=&quot;border: 0px; padding-top: 0px; position: relative;&quot;&gt;
              &lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;&gt;
                            &lt;tr&gt;&lt;td height='55'&gt;&lt;/td&gt;&lt;/tr&gt;
                            &lt;tr&gt;
                              &lt;td align='left'&gt;
                                &lt;div class=&quot;contentEditableContainer contentTextEditable&quot;&gt;
                                  &lt;div class=&quot;contentEditable&quot; align='center'&gt;
                                    &lt;h2 &gt;Will this be your welcome email?&lt;/h2&gt;
                                  &lt;/div&gt;
                                &lt;/div&gt;
                              &lt;/td&gt;
                            &lt;/tr&gt;
  
                            &lt;tr&gt;&lt;td height='15'&gt; &lt;/td&gt;&lt;/tr&gt;
  
                            &lt;tr&gt;
                              &lt;td align='left'&gt;
                                &lt;div class=&quot;contentEditableContainer contentTextEditable&quot;&gt;
                                  &lt;div class=&quot;contentEditable&quot; align='center'&gt;
                                    &lt;p &gt;
                                      Here’s what you can say: Thanks again for signing up to the newsletter! You’re all set up, and will be getting the emails once per week. Meanwhile, you can check out our &lt;a target='_blank' href='#' class='link1' &gt;Getting Started&lt;/a&gt; section to get the most out of your new account. 
                                      &lt;br&gt;
                                      &lt;br&gt;
                                      Have questions? Get in touch with us via Facebook or Twitter, or email our support team.
                                      &lt;br&gt;
                                      &lt;br&gt;
                                      Cheers,
                                      &lt;br&gt;
                                      &lt;span style='color:#222222;'&gt;Peter Parker&lt;/span&gt;
                                    &lt;/p&gt;
                                  &lt;/div&gt;
                                &lt;/div&gt;
                              &lt;/td&gt;
                            &lt;/tr&gt;
  
                            &lt;tr&gt;&lt;td height='55'&gt;&lt;/td&gt;&lt;/tr&gt;
  
                            &lt;tr&gt;
                              &lt;td align='center'&gt;
                                &lt;table&gt;
                                  &lt;tr&gt;
                                    &lt;td align='center' bgcolor='#1A54BA' style='background:#DC2828; padding:15px 18px;-webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;'&gt;
                                      &lt;div class=&quot;contentEditableContainer contentTextEditable&quot;&gt;
                                        &lt;div class=&quot;contentEditable&quot; align='center'&gt;
                                          &lt;a target='_blank' href='#' class='link2' style='color:#ffffff;'&gt;Activate your Account&lt;/a&gt;
                                        &lt;/div&gt;
                                      &lt;/div&gt;
                                    &lt;/td&gt;
                                  &lt;/tr&gt;
                                &lt;/table&gt;
                              &lt;/td&gt;
                            &lt;/tr&gt;
                            &lt;tr&gt;&lt;td height='20'&gt;&lt;/td&gt;&lt;/tr&gt;
                          &lt;/table&gt;
          &lt;/div&gt;
          &lt;div class=&quot;movableContent&quot; style=&quot;border: 0px; padding-top: 0px; position: relative;&quot;&gt;
              &lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td height='65'&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td  style='border-bottom:1px solid #DDDDDD;'&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;&lt;td height='25'&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign=&quot;top&quot; class=&quot;specbundle&quot;&gt;&lt;div class=&quot;contentEditableContainer contentTextEditable&quot;&gt;
                                        &lt;div class=&quot;contentEditable&quot; align='center'&gt;
                                          &lt;p  style='text-align:left;color:#CCCCCC;font-size:12px;font-weight:normal;line-height:20px;'&gt;
                                            &lt;span style='font-weight:bold;'&gt;[CLIENTS.COMPANY_NAME]&lt;/span&gt;
                                            &lt;br&gt;
                                            [CLIENTS.ADDRESS]
                                            &lt;br&gt;
                                            &lt;a target='_blank' href=&quot;[FORWARD]&quot;&gt;Forward to a friend&lt;/a&gt;&lt;br&gt;
                                            &lt;a target=&quot;_blank&quot; class='link1' class='color:#382F2E;' href=&quot;[UNSUBSCRIBE]&quot;&gt;Unsubscribe&lt;/a&gt;
                                            &lt;br&gt;
                                            &lt;a target='_blank' class='link1' class='color:#382F2E;' href=&quot;[SHOWEMAIL]&quot;&gt;Show this email in your browser&lt;/a&gt;
                                          &lt;/p&gt;
                                        &lt;/div&gt;
                                      &lt;/div&gt;&lt;/td&gt;
        &lt;td valign=&quot;top&quot; width=&quot;30&quot; class=&quot;specbundle&quot;&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td valign=&quot;top&quot; class=&quot;specbundle&quot;&gt;&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign='top' width='52'&gt;
                                      &lt;div class=&quot;contentEditableContainer contentFacebookEditable&quot;&gt;
                                        &lt;div class=&quot;contentEditable&quot;&gt;
                                          &lt;a target='_blank' href=&quot;#&quot;&gt;&lt;img src=&quot;images/facebook.png&quot; width='52' height='53' alt='facebook icon' data-default=&quot;placeholder&quot; data-max-width=&quot;52&quot; data-customIcon=&quot;true&quot;&gt;&lt;/a&gt;
                                        &lt;/div&gt;
                                      &lt;/div&gt;
                                    &lt;/td&gt;
        &lt;td valign=&quot;top&quot; width=&quot;16&quot;&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td valign='top' width='52'&gt;
                                      &lt;div class=&quot;contentEditableContainer contentTwitterEditable&quot;&gt;
                                        &lt;div class=&quot;contentEditable&quot;&gt;
                                          &lt;a target='_blank' href=&quot;#&quot;&gt;&lt;img src=&quot;images/twitter.png&quot; width='52' height='53' alt='twitter icon' data-default=&quot;placeholder&quot; data-max-width=&quot;52&quot; data-customIcon=&quot;true&quot;&gt;&lt;/a&gt;
                                        &lt;/div&gt;
                                      &lt;/div&gt;
                                    &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;&lt;td height='88'&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  
          &lt;/div&gt;
          
        
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/td&gt;
        &lt;td valign=&quot;top&quot; width=&quot;40&quot;&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  
  
        &lt;/body&gt;
        &lt;/html&gt;
  </code></pre>