【问题标题】:Email not sending through 1and1 smtp host nodemailer caddy电子邮件未通过 1and1 smtp 主机 nodemailer caddy 发送
【发布时间】:2018-08-06 04:37:08
【问题描述】:

在我的 nodejs express 应用程序中,当新用户注册时,我使用 nodemailer 发送电子邮件,这是我的电子邮件配置,在我的 config.json 中:

 {
   "senderEmail": "email",
    "senderEmailPassword":"password",
    "smtpPort":587,
    "smtpHost":"smtp.1and1.com"
 }

和transporterOptions如下:

var transporterOptions = {
    host: config.smtpHost,
    port: config.smtpPort,
    auth: {
        user: config.senderEmail,
        pass: config.senderEmailPassword
    },
    secure:false
};

现在在我的本地(开发)环境中,它可以从 1and1 主机发送电子邮件,但问题是当我使我的应用程序上线(生产)时,它无法发送电子邮件,错误如下: 错误:连接超时 堆栈跟踪如下:

{ Error: Connection timeout
at SMTPConnection._formatError (/home/*/*/*/node_modules/nodemailer/lib/smtp-connection/index.js:591:19)
at SMTPConnection._onError (/home/*/*/*/node_modules/nodemailer/lib/smtp-connection/index.js:564:20)
at Timeout._connectionTimeout.setTimeout (/home/*/*/*/node_modules/nodemailer/lib/smtp-connection/index.js:256:18)
at ontimeout (timers.js:386:11)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5) code: 'ETIMEDOUT', command: 'CONN' }

服务器配置是通过caddy完成的。 提前谢谢你。

【问题讨论】:

  • 我们能看到完整的堆栈跟踪吗?
  • 我已经编辑了我的问题。

标签: node.js google-cloud-platform nodemailer caddy


【解决方案1】:

GCE does not allow outbound connections on port 25。如果 1&1 在非标准端口上支持入站电子邮件,那么您可以使用它。上面列出的页面包含使用 Sendgrid、Mailgun 和 Mailjet(为此使用非标准端口)发送电子邮件的指南。

【讨论】:

    猜你喜欢
    • 2019-05-15
    • 1970-01-01
    • 2017-05-16
    • 1970-01-01
    • 2015-07-02
    • 1970-01-01
    • 2015-07-12
    • 2021-12-28
    • 2013-08-22
    相关资源
    最近更新 更多