2014-02-24 73 views
0

我不明白Gmail作爲ActionMailer發生了什麼。在heroku中部署時不會發送任何確認電子郵件。我可以在開發中輕鬆使用它。當我使用heroku進行部署時出現問題。Gmail作爲ActionMailer部署在heroku問題

這些都是我在production.rb設置

config.action_mailer.smtp_settings = { 
    :address => "smtp.gmail.com", 
    :port => 587, 
    :domain => 'floating-castle-4592.herokuapp.com', 
    :user_name => '[email protected]', 
    :password => ENV['PASS'], 
    :authentication => :login, 
    :enable_starttls_auto => true 
} 

設置在development.rb

config.action_mailer.smtp_settings = { 
    :address => 'smtp.gmail.com', 
    :port => 587, 
    :domain => 'gmail.com', 
    :authentication  => :login, 
    :user_name   => '[email protected]', 
    :password   => ENV['PASS'], 
    :enable_starttls_auto => true 
} 

我試着換 '登錄' 與 '普通',域名: 'gmail.com' 與'blahblah.herokuapp.com'。我嘗試了所有的排列和組合。目前爲止沒有成功。我在smtp_settings中也嘗試了「:openssl_verify_mode =>'none'」選項。這並沒有帶來我的成功!我真的不明白這裏發生了什麼。

如果您需要更多信息,我會編輯帖子。

我以前發佈了無錯日誌。 參考這個職位,我深入挖掘日誌記錄級別,以找出錯誤stackoverflow.com/a/6766529/1881153

的新進展:

Heroku的日誌顯示錯誤的

ArgumentError (SMTP-AUTH requested but missing secret phrase) 

任何幫助將是很大的不勝感激!謝謝!

+0

好!刪除密碼爲'xxx'的ENV ['PASS']爲我工作。奇怪的! – nk06

回答

0

而不是在生產中使用Gmail時,我會用freemium Heroku的插件之一來處理SMTP推薦 - 無論是SendGridMandrill

我們有這個設置與SendGrid工作:

#config/environments/production.rb 
    config.action_mailer.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 
    } 
+0

謝謝,豐富。肯定會考慮這個選項。我想知道爲什麼這不起作用。 – nk06

+3

回答會員的問題,然後發表你的意見的最佳做法。 – SoEzPz

+0

如果您對答案不滿意,請自行編寫。 –