7

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.

Matthias
  • 1,573
  • 2
  • 14
  • 28
asdjkag
  • 382
  • 1
  • 5
  • 22

2 Answers2

9

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: 'no-reply@example.com'}

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

Andries
  • 101
  • 2
  • 4
1

The one below works for me. Paste the snippet in your config/initializers/mail.rb file:

ActionMailer::Base.sendmail_settings = {
        location: "/usr/sbin/sendmail",
        arguments: '-i -t'
}

ActionMailer::Base.delivery_method = :sendmail
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.default charset: "utf-8"
Michael Gaskill
  • 7,567
  • 10
  • 37
  • 39
tokhi
  • 18,588
  • 21
  • 88
  • 102