簡體   English   中英

僅在服務器上的 Nodemailer 連接錯誤

[英]Nodemailer connection Error only on server

我正在使用 nodemailer 從 nodejs 項目發送郵件,並使用 godaddy 提供的 outlook 服務進行郵件服務,它在我的本地服務器上工作正常,但是一旦我將我的項目轉移到生產服務器,它就會出現如下所述的錯誤

收到錯誤

0|node  | {"message":"message - Connection timeout, stack trace - Error: Connection timeout\n    at SMTPConnection._formatError (/var/www/html/dev/project/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)\n    at SMTPConnection._onError (/var/www/html/dev/project/node_modules/nodemailer/lib/smtp-connection/index.js:770:20)\n    at Timeout._connectionTimeout.setTimeout (/var/www/html/dev/project/node_modules/nodemailer/lib/smtp-connection/index.js:235:22)\n    at ontimeout (timers.js:436:11)\n    at tryOnTimeout (timers.js:300:5)\n    at listOnTimeout (timers.js:263:5)\n    at Timer.processTimers (timers.js:223:10)","level":"error"}
0|node  | { Error: Connection timeout
0|node  |     at SMTPConnection._formatError (/var/www/html/dev/project/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
0|node  |     at SMTPConnection._onError (/var/www/html/dev/project/node_modules/nodemailer/lib/smtp-connection/index.js:770:20)
0|node  |     at Timeout._connectionTimeout.setTimeout (/var/www/html/dev/project/node_modules/nodemailer/lib/smtp-connection/index.js:235:22)
0|node  |     at ontimeout (timers.js:436:11)
0|node  |     at tryOnTimeout (timers.js:300:5)
0|node  |     at listOnTimeout (timers.js:263:5)
0|node  |     at Timer.processTimers (timers.js:223:10) code: 'ETIMEDOUT', command: 'CONN' }

使用的節點郵件程序配置

var smtpTransport = nodemailer.createTransport({
host: "smtp.office365.com",
secureConnection: true,
port: 587,
service: 'Godaddy',
debug: false,
auth: {
  user: USER_NAME,
  pass: PASSWORD
}

});

注意:共享您的身份驗證憑據是不安全的。

第一:go到你的辦公室並啟用email應用程序訪問

第二:啟用安全屬性意味着您啟用了 TLS,因此請確保您從此鏈接https://nodemailer.com/smtp/正確應用了 TLS

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM