Search code examples
ruby-on-railsgmail

Rails Mailer Net::SMTPServerBusy


With my rails site, when I try to send mail through GMail, it works perfectly. But when I try to send it through MandrillApp, it gives the following error (RController.create is where the deliver command is called):

Net::SMTPServerBusy in RController#create 
454 4.7.1 <[email protected]>: Relay access denied

Here's my config/environments/development.rb file:

 # ActionMailer Config
 config.action_mailer.default_url_options = { :host => 'localhost:3000' }
 config.action_mailer.delivery_method = :smtp
config.action_mailer.default :charset => "utf-8"

config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true

config.action_mailer.delivery_method = :smtp
# config.action_mailer.smtp_settings = {
#   :address              => "smtp.gmail.com",
#   :port                 => 587,
#   :domain               => 'gmail.com',
#   :user_name            => '[email protected]',
#   :password             => 'password',
#   :authentication       => 'plain',
#   :enable_starttls_auto => true  }

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

As it is above, the code doesn't work - I don't get an email and no errors pop up. If I switch to sending it from GMail, I get an email almost instantly. I've never worked with Mandrill before, so any help would be appreciated.


Solution

  • I ended up talking to a service rep from Mandrill, and it turns out that I was using the actual strings instead of the environment variables, so I just had to remove "ENV" from the config file.

    I ended up going back and making environment variables for security's sake, but I just thought I'd throw that out there in case anyone else has the same problem and finds this question.