Nodemailer,带CSS的自定义电子邮件html模板

时间:2016-08-25 05:19:20

标签: node.js nodemailer

我试图在我的电子邮件模板中添加一些css样式,但看起来当它显示在用户的收件箱中时,似乎css已关闭。

function email() {

  var html = '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">'
  html += 'Hello,<br> Hey click on the link to verify your email.<br>';
  html += "<a type='button' class='btn btn-primary btn-lg' href='http://localhost:3000/hello'";

  return html;

}

电子邮件代码

   var transporter = nodemailer.createTransport(smtpTransport({
  service: 'gmail',
  host : 'smtp.gmail.com',
  secureConnection : true,
  auth : {
    user: 'auth',
    pass: 'abc123'
  }
}));


mailOptions = {
  to : 'user',
  subject : "Please confirm your Email account",
  html : email()
}

transporter.sendMail(mailOptions, function(error, response) {
  if(error){
    console.log(error);

  }else{
    console.log("Message sent: " + response);

  }
});

css没有显示,我做错了什么?

0 个答案:

没有答案