我能够发送静态电子邮件来修复邮件 ID 和修复内容,如何在 Nodemailer 中使其动态。
transporter.sendMail({
from: 'test@test.com',
to: 'ashutosh.jha@mail.vinove.com',
subject: 'Ashutosh Jha : credentials',
text: 'hello how are you'
});
最佳答案
几个选项。
var body = 'Hello ' + name + ', how are you?';
var sprintf = require('sprintf-js').sprintf;
var body2 = sprintf('Hello %s, how are you?', name);
或者您可以使用模板引擎,例如 Swig或HandleBars .
关于node.js - 如何以文本形式发送变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34491520/