Reputation: 41919
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"]
}
Upvotes: 20
Views: 8162
Reputation: 2280
Here are a few things you can try based on the information you provided:
make sure the correct information is in each of your environment files (production.rb and development.rb)
try hardcoding the username and password for mandrill as opposed to using environmental variables (for testing only)
Upvotes: 0
Reputation: 8995
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.
Upvotes: 36