我正在使用 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 将包含我的反应客户的地址,这可能吗?还是我需要手动设置?