2017-06-28 9 views
0

node.jsプログラムを使用して複数のユーザーにメールを送信するにはどうすればいいですか?このプログラムを試しました。私は誤りがあります。私は以下のエラーを投稿しました。誰でもこのエラーを解決できますか?nodejsを使用して複数のユーザーにメールを送信する方法は?

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: '[email protected]', 
     pass: '************' 
    } 
}); 
var mailOptions = { 
    from: "[email protected]", 
    subject:"DIFFERENT EXPERIENCE" , 
    text: "This IS viki I sent this email using node.js program .This is really different experience", 
    to: "[email protected],[email protected]" 
}; 
transporter.sendMail(mailOptions, function(error, info) { 
    if (error) { 
     return console.log(error); 
    } 
    console.log('Message %s sent: %s', info.messageId, info.response); 
}); 

答えて

0

これは基本的にファイアウォールが原因である可能性があり、

あなたが同じポート465に同じマシン&からGmailのSMTPへの接続を試みるが、別のアプリケーションを介してすることができ、接続の問題を示しています。 セイのopensslを経由して

openssl s_client -connect smtp.gmail.com:465

+0

ファイアウォールは状態のみを有効です。 ホストのようなトランスポータ変数を追加しました: 'smtp.example.com'、 ポート:465、 secure:true、ここではopenssl s_clientを使用できます-connect smtp.gmail.com:465 –

+0

'openssl s_client -connect smtp .gmail.com:465'、あなたは上記の問題に直面しているのと同じマシン上で、マシンがGmailのsmtpサーバーに接続できるかどうかを確認するのに役立ちます。コマンドラインで使用する – Shivam

関連する問題