本文介绍了在生产服务器(DigitalOcean)上的rails应用程序中使用哪个端口通过SMTP(mailgun)发送电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在配置有capistrano和mailgun的数字海洋小滴上部署了一个Rails应用程序,但是我在发送电子邮件时遇到了麻烦,这是我使用delay_jobs完成的任务.问题是每次尝试发送电子邮件时,我都会得到连接超时(已在服务器中使用RAILS_ENV=production bin/delayed_jobs run进行了验证),我发现由于某种原因,数字海洋不允许您默认通过端口587进行访问(实际上是,运行telnet smtp.mailgun.org 587需要很长时间才能访问),但显然可以通过2525端口(mailgun也支持该端口,运行telnet smtp.mailgun.org 2525会立即连接!).但是同样,它仍然给我连接超时的时间,所以我有点困惑,不知道该怎么办.我可能会向DO发送一张罚单,要求打开587端口,在那之前您有任何想法吗?

I have a rails app deployed at a digital ocean droplet configured with capistrano and mailgun, but I'm having trouble sending emails, task which I do using delayed_jobs. The thing is every time it tries to send an email I get connection timeout (verified using RAILS_ENV=production bin/delayed_jobs runin the server) and I found out that for some reason digital ocean does not allow from default for you to access through port 587 (and indeed, running telnet smtp.mailgun.org 587 takes a very long time to access) but apparently trough port 2525 you can (mailgun also supports that port and running telnet smtp.mailgun.org 2525 connects instantly!). But again, it still gives me connection timeout, so I'm kind of confused and don't know what to do. I'll probably send a ticket to DO asking to open port 587, until then do you have any ideas?

推荐答案

出于安全原因,Digital Ocean基于CAN SPAM Act( https://www.ftc.gov/tips-advice/business-center/guidance/can-spam-act -compliance-guide-business ),因此,如果您想在其服务器上使用SMTP发送电子邮件,则需要发送一张票证,要求使用有关您自己的一些信息取消阻止它,以便他们验证您不仅是个疯子试图淹没人们的邮箱或机器人.

Digital Ocean blocks SMTP for safety reasons, based on the CAN SPAM Act (https://www.ftc.gov/tips-advice/business-center/guidance/can-spam-act-compliance-guide-business), so if you want to send emails using SMTP in their servers you'll need to send a ticket asking to unblock it with some infos about yourself so they verify your not just some crazy guy trying to flood people mail boxes or a robot.

希望有帮助!祝你好运

这篇关于在生产服务器(DigitalOcean)上的rails应用程序中使用哪个端口通过SMTP(mailgun)发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 20:30