我不能理解關於電子郵件的一些微不足道的東西,但defaul_url_options中的主機是做什麼的?我需要配置smtp設置來配置電子郵件的發送方式,但default_url_options與此有關嗎?什麼是ActionMailer 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
}