2017-08-17 81 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我添加引用意味着它显示错误所有我尝试但它给错误 –