我无法让 sendgrid 在使用 authlogic 进行身份验证并部署在 heroku 上的 rails 3.1 应用程序上成功发送电子邮件。我在 config/environments/[development.rb 和 production.rb] 上有以下动作邮件配置:
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.default_charset = "utf-8"
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => 587,
:domain => ENV['SENDGRID_DOMAIN'],
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:authentication => 'plain',
:enable_starttls_auto => true
}
对于production.rb,上面的代码是一样的,除了
config.action_mailer.default_url_options = { :host => [app name in heroku] }
当我运行它的开发模式时,我收到以下错误报告:
Completed 500 Internal Server Error in 21740ms
Net::SMTPFatalError (550 Cannot receive from specified address notification@[app-domain]: Unauthenticated senders not allowed
):
我现在真的不知道如何设置它以使其正常工作。有没有在 heroku 和 rails 上设置 sendgrid 的经验的人知道发生了什么?
太感谢了。你们是最棒的!!!