Как отправить почту с помощью узла с шаблоном
var transporter = nodemailer.createTransport('smtps://user%40gmail.com:pass@smtp.gmail.com');
// create template based sender function
var sendPwdReminder = transporter.templateSender({
subject: 'Password reminder for {{username}}!',
text: 'Hello, {{username}}, Your password is: {{ password }}',
html: '<b>Hello, <strong>{{username}}</strong>, Your password is:\n<b>{{ password }}</b></p>'
}, {
from: 'sender@example.com',
});
// use template based sender to send a message
sendPwdReminder({
to: 'receiver@example.com'
}, {
username: 'Node Mailer',
password: '!"\'<>&some-thing'
}, function(err, info){
if(err){
console.log('Error');
}else{
console.log('Password reminder sent');
}
});
Dead Dunlin