简体   繁体   中英

Rails with Heroku not sending Mandrill emails

I am starting a rails app and would like to use Mandrill to confirm Devise sign up and for other features in the future. Yesterday it was working sometimes on local so I thought maybe I would try on Heroku.

When using Heroku's Mandrill add-on it works, but if I change the ENV credentials to my own Mandrill account the emails get backlogged on my own account.

I am testing it using two personal emails, gmail and a school one.

I also use figaro to copy my environment variables to 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:

(I copied the actual username and API key.)

MANDRILL_USERNAME: myemail@gmail.com
MANDRILL_APIKEY: ######################
ADMIN_NAME: First User
ADMIN_EMAIL: user@example.com
ADMIN_PASSWORD: changeme 
ROLES: [admin, user, VIP]

The username for Mandrill Heroku provides me with is something@heroku.com .

For anyone that faces the same problem. This is caused by Mandrills algorithm to determine how many emails you are allowed to send in a time period. To resolve it, I emailed their technical team and they were able to increase the limit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM