首页 > 解决方案 > 原始 HTML 正在通过我的网络应用程序发送

问题描述

我正在尝试nodemailer为我的网站实施电子邮件验证系统,但它正在向html用户发送原始邮件。请帮忙


var html = '<h1>Hello !</h1><p>This is some content \
that will display. You can even inject your first name,  \
in the code.</p><p><a href="http://www.google.com">Search</a> for \
stuff on the Google website.</p>';
let mailOptions = {
  from: "abc@gmail.com", // TODO: email sender
  to: "example@gmail.com", // TODO: email receiver
  subject: "Account Verfication",
  text: html,
};

// Step 3
transporter.sendMail(mailOptions, (err, data) => {
  if (err) return log(err);
});

标签: javascriptnode.jsnodemailer

解决方案


您将其作为文本发送。请改用“html”键。请参阅https://nodemailer.com/message/


推荐阅读