【发布时间】:2017-10-13 04:18:23
【问题描述】:
我一定不明白一些关于电子邮件的琐碎事情,但 defaul_url_options 中的主机是做什么的?对 smtp 设置的需求对我来说是有意义的,以配置电子邮件的发送方式,但 default_url_options 与此有何关系?
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
host = '<your heroku app>.herokuapp.com'
config.action_mailer.default_url_options = { host: host }
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => '587',
:authentication => :plain,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => 'heroku.com',
:enable_starttls_auto => true
}
【问题讨论】:
标签: ruby-on-rails actionmailer