Sending email through nodemailer goes into spam for gmail

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>', // sender address
    to: 'xxxx@gmail.com',
      subject: 'Account activation',
      html: html,
      text:text    
  });    
});
+6
source share
2 answers

The truth is that for your problem there are no simple one-line solutions :) There are many reasons why this can happen, and here are some of them:

  • - , . ,

  • from , - , smtp, , . , mark@facebook.com, SMTP- facebook.com,

  • , , . .

  • - "" , .

  • - 100% , , (, from)

, , , . :)

+9

, 👥 . , , .

gmail. . , . IP-, , .

!

PS. , - .

+5

Source: https://habr.com/ru/post/1660775/


All Articles