Rails and SMTP on ubuntu 12.04 x64

September 28, 2013 4.8k views
Running Rails 4 wih passenger, when attempt to send email it crashes with Completed 500 Internal Server Error (in the log). Do I need to set up Postfix in order to send emails from the app? My prduction SMTP settings `config.action_mailer.default_url_options = {:host => domain.com'} config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => "localhost", :port => 25, :domain => 'domain.com' }`
6 Answers
I recommend using a service such as Mandrill to send mail as it's better than setting up your own mailserver.

You can also install postfix and it should work fine.
I'll try mandrill, after setting up postfix and SPF all emails go to spam... so it's not very reliable. Thank you.
How much mail do you anticipate sending? If it's on the low end, perhaps a lightweight client like exim4 would work?
low end for sure, I send emails to register new users. I set up mandrill, sfp, DKIM and still emails go to spam (hotmail, gmail)... any idea what else can be done ?
"I set up mandrill, sfp, DKIM and still emails go to spam..."

WTF!? The only thing I can think of is that your SPF record may need more time to propagate through the internet.

RE: your SPF record

Did you wrap it in quotes (if you're using DigitalOcean's DNS manager); and use ".... ~all" at the end?
quotes were missing (they were there before I tried mandrill though).

I fixed quotes and added config.action_mailer.default_url_options host (domain name), restarted nginx - now looks like everything is working ok, email doesn't go to spam. I'm using mandrill
Have another answer? Share your knowledge.