2017-08-17 27 views
-1

它給出了一個語法錯誤。這是在nodejs中聲明html的正確格式。我嘗試了所有的東西,如單獨創建變量,然後聲明只有我得到的相同的錯誤。如何在nodejs中聲明html表格

let mailOptions = { 

         from: '[email protected]', 
         to: '[email protected]', 
         subject: 'mail notification Test', 
         html:<html> 
         <head> 
         <style> 
         table, th, td= 
          border: 1px solid black; 
          border-collapse: collapse; 

         </style> 
         </head> 
         <body> 
         <table style="width:100%"> 
          <tr> 
          <th>Id</th> 
          <th>Templatename</th> 
          <th>Description</th> 
          <th>TemplateContent</th> 
          <th>Activestate</th> 
          </tr> 
          <tr> 
          <td>streamingTemplate.id.toString().toLowerCase()</td> 
          <td>streamingTemplate.is_active.toString().toLowerCase()</td> 
          <td></td> 
          </tr> 
         </table> 
         </body> 
         </html> 

          }; 
+0

語法錯誤HTML代碼相應穩固的令牌 –

+0

separetely我創建變種的結果,那麼我定義HTML來了,如同結果同樣的錯誤: 語法錯誤:意外令牌< –

+0

您需要引用您的html模板。 – TGrif

回答

0

你只需要引用你喜歡這個

let mailOptions = { 
    from: '"Fred Foo" <[email protected]>', // sender address 
    to: '[email protected], [email protected]', // list of receivers 
    subject: 'Hello', // Subject line 
    text: 'Hello world ?', // plain text body 
    html: '<b>Hello world ?</b>' // html body 
}; 
+0

在html我添加引用意味着它顯示錯誤所有我嘗試但它給錯誤 –