Rails ar_mailer无法发送电子邮件
时间:2020-03-06 14:29:45 来源:igfitidea点击:
我刚将应用程序切换为使用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
解决方案
我们正在使用哪个版本的ar_mailer?一个Gmail特定的错误已在1.3.1中修复,如下所示:
http://rubyforge.org/forum/forum.php?forum_id=16364
在lib中进行了一些挖掘,看来如果我们想使用TLS(就像对Gmail一样),则会在:tls的ActionMailer :: Base.smtp_settings中添加一个新选项(默认值为false),我们应该这样做设置为true。
安装说明中唯一提到的关于TLS的内容是删除任何其他smtp_tls文件,但是我并不需要tls选项才能工作。
也许我们使用的是Ruby版本1.8.7
我们不需要smtp_tls
。
我们只需要添加enable_startls_auto
选项:
ActionMailer::Base.smtp_settings = { :enable_starttls_auto => true, ... ... }