【发布时间】:2014-09-09 09:52:18
【问题描述】:
我在config/environments/production.rb有标准设置
config.action_mailer.default_url_options = { host: "myapp.heroku.com" }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:addresses => 'smtp.sendgrid.net',
:port => '587',
:authentication => :plain,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => 'heroku.com',
:enable_starttls_auto => true
}
但是,我在尝试发送邮件时遇到了以下错误:
ArgumentError: An SMTP From address is required to send a message. Set the message smtp_envelope_from, return_path, sender, or from address.
然后我尝试使用我在 heroku 附加页面上找到的电子邮件,即app######@heroku.com,但现在我得到了
Errno::ECONNREFUSED: Connection refused - connect(2)
那么我是否需要指定发件人电子邮件?如果是,我应该使用哪一个?
【问题讨论】:
标签: ruby-on-rails email heroku sendgrid