【发布时间】:2020-02-12 00:44:24
【问题描述】:
我正在使用 nodemailer 发送关于我的项目的确认电子邮件, 像这样:
var mailOptions = {
from: "alex@account",
to: req.body.email,
subject: "Account Verification Token",
html: `<p>Hello,<br/> Please verify your account by clicking the link <br/> <a href=http://${req.headers.host}/confirmation/${token}>Click here to verify</a></p>\n`
};
我正在发送一个包含 req.headers.host 的 href 链接,这是我的节点地址 localhost:6000,但我希望它是我的反应地址 localhost:4000,因为它稍后会更改,我希望有一个变量jst 像 req.headers.host 将包含我的反应客户端的地址,这可能吗?还是我需要手动设置?
【问题讨论】:
标签: node.js nodemailer req