2017-06-07 4 views
0

私はRailsアプリケーションでアカウントを作成する新規ユーザーにアカウント確認メールを送信しようとしています。アクションSendgridとHerokuを使ってデプロイしたときにMailer production.rbが動作しない

私は正常にdevelopment.rb経由でローカルにデプロイしましたが、何らかの理由で「申し訳ありませんが、何か問題が発生しました」というエラーメッセージが毎回表示されます。 。 Stack OverflowとHeroku、Youtubeの両方のリソースを見直し、解決策を見つけることができませんでした。ここで

は、環境/ production.rbで私のコードです:再び

# Don't care if the mailer can't send. 
config.action_mailer.raise_delivery_errors = true 
config.action_mailer.perform_deliveries = true 
config.action_mailer.delivery_method = :smtp 
config.action_mailer.smtp_settings = { 
address: "smtp.sendgrid.net", 
port: 587, 
domain: ENV["SENDGRID_DOMAIN"], 
authentication: "plain", 
enable_starttls_auto: true, 
user_name: ENV["SENDGRID_USERNAME"], 
password: ENV["SENDGRID_PASSWORD"] 
} 

config.action_mailer.default_url_options = {:host => "<myherokuappname>.herokuapp.com/"} 


config.action_mailer.perform_caching = false 

だけで確認する、私だけではない、生産レベルでは、ローカルにメールを展開することができますよ。どんなヒントも大歓迎です。

答えて

0

私は最近、HerokuアプリにSendGridも統合しました。私のproduction.rbの設定は次の通りです:

config.action_mailer.raise_delivery_errors = true 
    config.action_mailer.default_url_options = { host: '<myherokuappname>.herokuapp.com' } 
    config.action_mailer.delivery_method = :smtp 
    config.action_mailer.smtp_settings = { 
    :user_name => ENV['SENDGRID_USERNAME'], 
    :password => ENV['SENDGRID_PASSWORD'], 
    :domain => '<myherokuappname>.herokuapp.com', 
    :address => 'smtp.sendgrid.net', 
    :port => 587, 
    :authentication => :plain, 
    :enable_starttls_auto => true 
    } 

私はちょうど数分前にこれをテストし、うまくいきます。

関連する問題