Nodemailer - 无法发送可点击的 link
Nodemailer - Unable to send clickable link
我正在使用 nodemailer 从我的 nodejs 应用程序发送电子邮件。我能够成功发送电子邮件。但是,如果我想发送 link,则 href 或锚标记不起作用。也就是说 link 不会作为邮件的一部分。其余的文本已发送。有任何想法吗?
相关代码如下:
var messagebody = "Hello ".concat(req.body.name).concat(", One of your team mates have submitted an application form for intern next summer. Please approve or reject the same on the internship portal. Best Regards.");
var mailOptions = {
from: from, // sender address
to: to, // list of receiver
// cc: cc,
subject: subject, // Subject line
text: messagebody, // plaintext body
html: ' Hello '.concat(req.body.name).concat(' , <br /></br > One of your team mates have submitted an application for intern(s) for next summer. Please approve or reject the proposal on the internship portal. <br /> Here is the link of the internship portal : <a href="https://9.109.124.229:9100/"></a><br /><br /> Best Regards.') // html body
};
你的代码是正确的,但你没有在 <a></a>
标签之间写任何东西。
只需在它们之间放置一些文本即可。
<a href="https://9.109.124.229:9100/"> Click here </a>
您还可以渲染 jade(或 pug)文件并将其作为字符串获取
const render = jade.compileFile('./views/my_email.jade');
const html = render(content);
const mailOptions = {
from: from, // sender address
to: to, // list of receivers
subject: subject, // Subject line
html: html
};
其中 content
是包含要传递给 jade 文件的数据的数组
我正在使用 nodemailer 从我的 nodejs 应用程序发送电子邮件。我能够成功发送电子邮件。但是,如果我想发送 link,则 href 或锚标记不起作用。也就是说 link 不会作为邮件的一部分。其余的文本已发送。有任何想法吗?
相关代码如下:
var messagebody = "Hello ".concat(req.body.name).concat(", One of your team mates have submitted an application form for intern next summer. Please approve or reject the same on the internship portal. Best Regards.");
var mailOptions = {
from: from, // sender address
to: to, // list of receiver
// cc: cc,
subject: subject, // Subject line
text: messagebody, // plaintext body
html: ' Hello '.concat(req.body.name).concat(' , <br /></br > One of your team mates have submitted an application for intern(s) for next summer. Please approve or reject the proposal on the internship portal. <br /> Here is the link of the internship portal : <a href="https://9.109.124.229:9100/"></a><br /><br /> Best Regards.') // html body
};
你的代码是正确的,但你没有在 <a></a>
标签之间写任何东西。
只需在它们之间放置一些文本即可。
<a href="https://9.109.124.229:9100/"> Click here </a>
您还可以渲染 jade(或 pug)文件并将其作为字符串获取
const render = jade.compileFile('./views/my_email.jade');
const html = render(content);
const mailOptions = {
from: from, // sender address
to: to, // list of receivers
subject: subject, // Subject line
html: html
};
其中 content
是包含要传递给 jade 文件的数据的数组