Jak wysłać pocztę za pomocą węzła z szablonem
var transporter = nodemailer.createTransport('smtps://user%40gmail.com:[email protected]');
// 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: '[email protected]',
});
// use template based sender to send a message
sendPwdReminder({
to: '[email protected]'
}, {
username: 'Node Mailer',
password: '!"\'<>&some-thing'
}, function(err, info){
if(err){
console.log('Error');
}else{
console.log('Password reminder sent');
}
});
Dead Dunlin