0

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'ましたが、役に立ちませんでした。

4

0 に答える 0