我遇到了一个问题,让sendgrid在一个使用authlogic进行身份验证的rails 3.1应用上成功发送电子邮件,该应用正部署在heroku上。我在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的经验?
非常感谢。你们是最棒的!
https://stackoverflow.com/questions/8782274
复制相似问题