Email not sending through 1and1 smtp host nodemailer caddy

北慕城南 提交于 2020-01-05 04:50:58

问题


In my nodejs express application, I send email using nodemailer when a new user registers and this is my email configuration, in my config.json:

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

and the transporterOptions is as follows:

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

Now in my local (development) environment, it is able to send email from 1and1 host but the issue is when I make my application live(production), it fails to send email and the error is as follows: Error: Connection timeout and the stack trace is as follows:

{ 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' }

The server configuration is done through caddy. Thank you in advance.


回答1:


GCE does not allow outbound connections on port. If 1&1 supports inbound email on a non-standard port, then you can use that. The page lined above has guides to sending email with Sendgrid, Mailgun and Mailjet (which use non-standard ports for this).



来源:https://stackoverflow.com/questions/48993298/email-not-sending-through-1and1-smtp-host-nodemailer-caddy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!