Я выполнил эти шаги, чтобы настроить nodemailer 1) Разрешить доступ к менее безопасным приложениям в Gmail 2) Написал следующее в app.js
app.post('/reachus/send',function(req,res){
var transporter=nodemailer.createTransport({
service:'Gmail',
auth: {
user:'[email protected]',
pass:'***'
}
});
var mailOptions={
from:'Naveen DK <[email protected]>',
to:'[email protected]',
subject:'Email Sent from your website',
text:'You have a submission with the following details.. Name: '+req.body.name +'Email: '+req.body.email+' Message: '+ req.body.message,
html: '<p>You have a submission with the following details..</p><ul><li> Name :'+req.body.name + ' </li><li>Email: '+req.body.email +'</li><li>Message ' + req.body.message +'</li></ul>'
};
transporter.sendMail(mailOptions,function(error,info){
if(error){
console.log(error);
res.redirect('/');
} else{
console.log('Message Sent ' + info.response);
res.redirect('/');
}
});
});
3) Как только я нажимаю «Отправить по электронной почте», я получаю следующую ошибку
{ Error: read ECONNRESET
at exports._errnoException (util.js:1026:11)
at TLSWrap.onread (net.js:569:26)
code: 'ECONNECTION',
errno: 'ECONNRESET',
syscall: 'read',
command: 'CONN
}
Пожалуйста, найдите ниже 2 видео для более подробной информации.
1 https://www.dropbox.com/s/nc1zvivlfpabj6h/HowMyCodeLooksLike.wmv?dl=0
2 https://www.dropbox.com/s/tfsqu6ir90s682h/ErrorOnceSubmissionDone.wmv?dl=0
заранее спасибо
Naveen