3

所以我在设置这个 Rails 应用程序时遇到了麻烦(OpenProject,如果它有所作为)。当我尝试在 openproject 设置中发送测试邮件时,它会显示一条消息,指出电子邮件已发送,但我从未在该地址收到它。

配置/配置.yml

production:
  delivery_method: :smtp
  smtp_settings:
    tls: true
    address: "smtp.gmail.com"
    port: '587'
    domain: "smtp.gmail.com"
    authentication: :plain
    user_name: "your_email@gmail.com"
    password: "your_password"

development:
  delivery_method: :smtp
  smtp_settings:
    tls: true
    address: "smtp.gmail.com"
    port: '587'
    domain: "smtp.gmail.com"
    authentication: :plain
    user_name: "your_email@gmail.com"
    password: "your_password"

test:
  delivery_method: :test

如果我使用:

telnet smtp.gmail.com 587

Trying 64.233.171.108...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP r1sm2094806qam.42 – gsmtp

这使我认为我可以发送到 gmail,但我无法从 gmail 接收。我还尝试了所有配置,例如端口 25 和 456 以及 SSL 与 TLS,但没有。所以我不认为这只是我的 ISP 阻止了邮件。

在我的谷歌设置→帐户和导入→添加您拥有的另一个电子邮件地址通过您的 SMTP 服务器发送邮件。

SMTP server: smtp.my_domain_name.com
        Port: 587
    Username: my_username_on_my_domain
    Password: passwd
        TLS (recommended)       ← (I have this selected)
        SSL

我收到消息无法到达服务器。请仔细检查服务器和端口号。

我确实跑了

netstat -a

如果结果有帮助,请告诉我。

任何帮助将不胜感激。谢谢。

4

1 回答 1

0

不幸的是,您的问题中没有任何日志。请注意:

  • Gmail Api 不支持从不同地址发送电子邮件(防止垃圾邮件/欺骗)
  • Rails 可以从自己的应用程序发送电子邮件,这个选项告诉他使用什么主机。

考虑config.action_mailer.raise_delivery_errors = true调试您的代码和设置。

于 2014-12-05T09:53:14.287 回答