How to setup Postfix for Ruby On Rails to send email

asdjkag picture asdjkag · Jun 27, 2014 · Viewed 7.9k times · Source

I want to have postfix to send email in my ROR project. As its safer and hax more functionality.

But now I'm quite lost. I installed postfix, got ROR working. But next what should I do?

(I only need to send email, not receive it at the moment)

Should I configure postfix, make it able to send email in comment line first, then integrate it into ROR?

If so, how should I set up the configure file in postfix, and how about settings in rails?

Or do I just need do every setting in rails? If so, what should be the detailed setting?

I'm quite confused. Lots of tutorials either are not working or do not suit my situation.

Answer

Andries picture Andries · Sep 15, 2014

Example Action Mailer Configuration

An example would be adding the following to your appropriate

config/environments/$RAILS_ENV.rb file:

config.action_mailer.delivery_method = :sendmail
# Defaults to:
# config.action_mailer.sendmail_settings = {
#   location: '/usr/sbin/sendmail',
#   arguments: '-i -t'
# }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_options = {from: '[email protected]'}

More information: http://guides.rubyonrails.org/action_mailer_basics.html