2014-01-09 38 views
5

我正在啓動一個rails應用程序,並且想要使用Mandrill來確認設計註冊以及將來的其他功能。昨天它有時在當地工作,所以我想也許我會嘗試Heroku。Heroku無法發送Mandrill電子郵件的欄杆

當使用Heroku的Mandrill插件時,它可以工作,但是如果我將ENV憑證更改爲我自己的Mandrill帳戶,那麼電子郵件將會在我自己的帳戶上積壓。

我正在測試它使用兩個個人電子郵件,Gmail和學校之一。

我也使用figaro將我的環境變量複製到Heroku。

production.rb:

config.action_mailer.smtp_settings = { 
:address => "smtp.mandrillapp.com", 
:port  => 587, 
:user_name => ENV["MANDRILL_USERNAME"], 
:password => ENV["MANDRILL_APIKEY"] 
} 

# ActionMailer Config 
config.action_mailer.default_url_options = { :host => 'herokuapp.com' } 
config.action_mailer.delivery_method = :smtp 
config.action_mailer.perform_deliveries = true 
config.action_mailer.raise_delivery_errors = false 

development.rb:

config.action_mailer.smtp_settings = { 
:address => "smtp.mandrillapp.com", 
:port  => 2525, # I also tried ports 25 and 587 
:user_name => ENV["MANDRILL_USERNAME"], 
:password => ENV["MANDRILL_APIKEY"] 
} 

# ActionMailer Config 
config.action_mailer.default_url_options = { :host => 'localhost:3000' } 
config.action_mailer.delivery_method = :smtp 
config.action_mailer.perform_deliveries = true 
config.action_mailer.raise_delivery_errors = true 

application.yml:

(我複製了實際用戶名和API密鑰。 )

MANDRILL_USERNAME: [email protected] 
MANDRILL_APIKEY: ###################### 
ADMIN_NAME: First User 
ADMIN_EMAIL: [email protected] 
ADMIN_PASSWORD: changeme 
ROLES: [admin, user, VIP] 

Mandrill Heroku的username爲我提供了[email protected]

+1

如果您仍然遇到這個問題,請看看[無法讓Mandrill從Rails應用程序發送電子郵件](https://stackoverflow.com/questions/11356541/cant-get-mandrill-to- send-emails-from-rails-app)和[使用Mandrill的SMTP與Web框架集成](http://help.mandrill.com/entries/21738467-Using-Mandrill-s-SMTP-integration-with-Web-Frameworks ) - 端口'587'爲我工作,但我也'認證'設置爲'普通','enable_starttls_auto'設置爲'true'。 – user664833

+0

你確定嗎,環境變量是從application.yml加載的,你可以使用配置變量,看看這裏https://devcenter.heroku.com/articles/config-vars – sahilbathla

回答

0

對於任何面臨同樣問題的人。這是由Mandrills算法決定的,以確定您在一段時間內允許發送多少封電子郵件。爲了解決這個問題,我給他們的技術團隊發了電子郵件,他們能夠增加限制。