我正在尝试将ActionMailer配置为使用我的Google Apps帐户以开发模式从Devise发送邮件。我已将以下内容添加到我的config / environments / development.rb文件中,但看起来好像没有发送邮件。注意:这适用于Google Apps,而非Gmail(但Gmail服务器应该可以使用 - 它们可以在我的邮件客户端中使用)。
我的配置中有什么东西跳出来的?
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => 587,
:domain => "mydomain.com",
:authentication => :login,
:user_name => "myemaiL@mydomain.com",
:password => "mypass"
}
答案 0 :(得分:0)
我们使用Google Apps帐户(和Devise)成功使用了所有相同的设置 - 唯一的区别是我们使用“plain”进行身份验证。
略有不同 - 我们在生产中使用它并在我们的暂存环境中进行排序(我们发送电子邮件,但都是测试电子邮件地址而不是用户)。在开发时,我们只需查看rails日志来调试电子邮件......
但有一件事你可能会检查:我在使用MacPorts设置的macbook上测试使用GMail,但使用rym和Homebrew设置了ruby / rails和其他东西,并且在此环境中获得了SSL异常 - 当我设置:enable_starttls_auto => false
时,错误停止,但没有发送邮件。我认为MacPorts安装的库和Rails使用的库之间存在冲突。
不确定是否有帮助: - )