我们如何使用node.js程序将邮件发送给多个用户?。我试过这个程序。我收到了一个错误。我在下面发布了错误。任何人都可以解决这个错误吗?
ERROR OCCURED:
{ Error: connect ECONNREFUSED 74.125.200.108:465
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
code: 'ECONNECTION',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '74.125.200.108',
port: 465,
command: 'CONN' }
NODE.JS PROGRAM:
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'vignesh.mack03@gmail.com',
pass: '************'
}
});
var mailOptions = {
from: "vignesh.mack03@gmail.com",
subject:"DIFFERENT EXPERIENCE" ,
text: "This IS viki I sent this email using node.js program .This is really different experience",
to: "vikirockz456@gmail.com,vigneshbv02@gmail.com"
};
transporter.sendMail(mailOptions, function(error, info) {
if (error) {
return console.log(error);
}
console.log('Message %s sent: %s', info.messageId, info.response);
});
答案 0 :(得分:0)
这基本上表示连接问题,可能是由于防火墙,
您可以尝试从同一台机器连接到gmail smtp吗?到同一个端口465,但通过不同的应用程序。 通过openssl说
openssl s_client -connect smtp.gmail.com:465