I send the email address through nodemailer, which is included in the gmail mailbox if I start from the local server, but gets into gmail spam if I run the script from the Microsoft Azure server. next my script
var nodemailer = require('nodemailer');
var EmailTemplates = require('swig-email-templates');
var smtpConfig = {
service: 'smtp.office365.com',
host: 'smtp.office365.com',
port: 587,
starttls: {
enable: true
},
secureConnection: true,
auth: {
user: 'xxxxx@yyyy.com',
pass: 'zzzzzz'
}
}
var templates = new EmailTemplates();
var transporter = nodemailer.createTransport(smtpConfig);
var context = {
username:'Rajesh',
email:'xxxxx@gmail.com',
link : 'www.google.co.in'
};
templates.render('activate_email.html', context, function(err, html,text, subject) {
transporter.sendMail({
from: '"Product Name👥" <no-reply@xxxxx.com>',
to: 'xxxx@gmail.com',
subject: 'Account activation',
html: html,
text:text
});
});
source
share