heroku に Rails アプリケーションをデプロイしています。
Herokuにもsendgrid:free
アドオンがあります。
アプリからメールを送信していますが、次のエラーが発生します。
Net::SMTPAuthenticationError (535-5.7.8 ユーザー名とパスワードが受け入れられません。詳細
my の関連部分は次のconfig/production.rb
とおりです。
config.action_mailer.default_url_options = { :host => 'book-post.herokuapp.com' }
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => "25",
:authentication => :plain,
:user_name => ENV["SENDGRID_USERNAME"],
:password => ENV["SENDGRID_PASSWORD"],
:domain => 'heroku.com'
}
これは私のconfig/action_mailer.rb
です:
config.action_mailer.default_url_options = { :host => 'book-post.herokuapp.com' }
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => "25",
:authentication => :plain,
:user_name => ENV["SENDGRID_USERNAME"],
:password => ENV["SENDGRID_PASSWORD"],
:domain => 'heroku.com'
}
使用してみ:port => '587'
ましたが、役に立ちませんでした。