Heroku Addonを利用できるようになる

Ruby on Rails チュートリアル:実例を使って Rails を学ぼう

 

 SendGridでメール転送。

 

%heroku addons:create sendgrid:starter

 

config/environments/production.rb

config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
host = 'https://model-test-heroku.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
}