Rails ar_mailer无法发送电子邮件
-
02-07-2019 - |
题
我刚刚将应用程序切换为使用ar_mailer,当我运行ar_sendmail时(长时间停顿后),我收到以下错误:
Unhandled exception 530 5.7.0 Must issue a STARTTLS command first. h7sm16260325nfh.4
我正在使用Gmail SMTP发送电子邮件,但我没有更改任何刚安装了ar_mailer的ActionMailer :: Base.smtp_settings。
版本:
Rails:2.1,ar_mailer:1.3.1
解决方案
在lib中进行了一些挖掘,似乎如果你想使用TLS(就像你使用Gmail一样),那么它会为ActionMailer :: Base.smtp_settings添加一个新选项:tls(默认为false)你应该设置为true。
安装说明中唯一提到的有关TLS的内容是删除任何其他smtp_tls文件,但我所使用的文件不需要使用tls选项。
其他提示
也许您使用Ruby版本1.8.7
您之前不需要 smtp_tls
。
您只需添加 enable_startls_auto
选项:
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
...
...
}
您使用的是哪个版本的ar_mailer? 1.3.1中修复了特定于gmail的错误,如下所示:
不隶属于 StackOverflow