Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get Mandrill to send emails from Rails App

I'm trying to send emails in a Rails app. It works if I use Gmail, but it's not working if I use Mandrill. I'm getting this timeout error with Mandrill. Not sure what I'm doing wrong. With both Gmail and Mandrill I am setting the username and password/api_key using environment variables. The only difference between the two setups is what you see below. Any ideas?

Timeout::Error in RegistrationsController#create

execution expired
Rails.root: /Users/michaeljohnmitchell/Sites/pre

Application Trace | Framework Trace | Full Trace
app/models/user.rb:38:in `send_welcome_email'

Mandrill Doesn't work

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

Gmail Works

config.action_mailer.smtp_settings = {
  address: "smtp.gmail.com",
  port: 587,
 authentication: "plain",
  enable_starttls_auto: true,
  user_name: ENV["GMAIL_USERNAME"],
  password: ENV["GMAIL_PASSWORD"]
}
like image 244
Leahcim Avatar asked Jul 06 '12 05:07

Leahcim


1 Answers

use port 587 for mandrill, happend the same to me :)

this is because port 25 is sending plain text and port 587 sends SSL encoded emails (which I think is the whole mandrill idea).

I have no idea why they set it to port 25 in their examples.

like image 167
Hassek Avatar answered Oct 30 '22 03:10

Hassek