N
N
Nicholas2016-08-08 10:11:38
gmail
Nicholas, 2016-08-08 10:11:38

Why does mail go to spam when sending mail via smtp gmail to a gmail mailbox?

Installed nodemailer on the node
and configured:

nodemailer = require('nodemailer');

var transporter = nodemailer.createTransport('smtps://имя@gmail.com:пароль@smtp.gmail.com');

app.post('/SendForm', function(req, res) {
    
    var template = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html class=" js no-touch"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title></title></head><body style="width: 600px; margin: auto;">'

    template += 'Форма: '+req.body.type+'<br>';
    template += 'Имя: '+req.body.name+'<br>';
    template += 'Телефон: '+req.body.telefon+'<br>';
    template += 'Позвоните мне: '+req.body.callme+'<br>';
    template += 'Whats app: '+req.body.whatsapp+'<br>';

    template += '</body></html>';


    
    var mailOptions = {
        from: '[email protected]', // sender address
        to: '[email protected]', // list of receivers 
        subject: 'Форма от '+req.body.name, // Subject line
        html: template // html body
    };

    // send mail with defined transport object
    transporter.sendMail(mailOptions, function(error, info){
        if(error){
            return console.log(error);
        }
        console.log('Message sent: ' + info.response);
    });
    
    res.end();
    
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
RubaXa, 2016-08-08
@RubaXa

Most likely a problem with DKIM, also configure Postmaster: https://support.google.com/mail/answer/6227174?hl=en

V
Vladimir Dubrovin, 2016-08-08
@z3apa3a

Check that the address from From and the address of the envelope ( envelope ) match the account under which authorization is performed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question