2017-11-01 22 views
0

ユーザー登録後にメールを送信しようとしています。 これにはnodemailerを使用しています。 このための私のコードは、私は私の窓のマシン上で私のローカルホスト上でこれを使用しますが、私は私のリモートサーバー上でこれを使用する場合、Linuxサーバであるときthis-nodemailerを使用してLinuxサーバーからメールを送信できません

var transporter = nodemailer.createTransport({ 
    service:"Mailjet", // sets automatically host, port and connection security settings 
    auth: { 
    user:'******', 
    pass:'*******' 
    } 
}); 
var mailOptions = { 
    to:mailTo, 
    from:'******', 
    subject:'user registered', 
    text:'welcome user' 
}; 
transporter.sendMail(mailOptions, function(err, info) { 
    if (err) { 
    logger.debug('error in sending email ' + err); 
    } else { 
    logger.debug('Message sent: ' + info.response); 
    }; 

メールが正常に起こっているように見えます。 私は次のエラーを取得する:

error--- { Error: Connection timeout at SMTPConnection._formatError (/root/root/server/cq-code/node_modules/nodemailer/lib/smtp-connection/index.js:557:19) at SMTPConnection._onError (/root/root/server/cq-code/node_modules/nodemailer/lib/smtp-connection/index.js:530:20) at Timeout._connectionTimeout.setTimeout (/root/root/server/cq-code/node_modules/nodemailer/lib/smtp-connection/index.js:248:18) at ontimeout (timers.js:471:11) at tryOnTimeout (timers.js:306:5) at Timer.listOnTimeout (timers.js:266:5) code: 'ETIMEDOUT', command: 'CONN' } info----- undefined

答えて

0

コードfine.Theの問題を働いていたが、サーバー上にあった、SMTPに使用する実際のポートがデジタルocean.Soによってブロックされた私は彼らと一緒にクエリを上げてのブロックを解除した後、そのポート、物事は期待どおりに働いた。

関連する問題