Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to send the mail using node with template

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:
<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');
    }
});
Source by community.nodemailer.com #
 
PREVIOUS NEXT
Tagged: #send #mail #node #template
ADD COMMENT
Topic
Name
9+8 =