According to chapters 5 and 5.1 of ActionMailer official doc : http://guides.rubyonrails.org/action_mailer_basics.html
We can see that there are no ':exim4' option available as 'delivery_method'.
So I would suggest to "cheat" ActionMailer that he is using sendmail (though he will use exim4).
Use the following configuration in your config/enviroments/production.rb file :
config.action_mailer.delivery_method = :sendmail
config.action_mailer.sendmail_settings = {
:location => '/usr/sbin/exim4',
:arguments => '-i'
}
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
Arguments match the following exim4 options :
- -t option causes the recipients of the message to be obtained from the To:, Cc:, and Bcc: header lines in the message instead of
from the command arguments.
- -i option prevents a line containing just a dot from terminating the message. Only an end-of-file does so.
Don't use the -t option.
In order to configure properly your Exim4 deamon, I suggest this quick how-to : http://noosfero.org/Development/MailSending
I highly recommend you choose "smarthost" on the first screen instead of "Internet site".
This is because mail providers of the Internet (gmail, yahoo, etc...) do block any e-mails that come from an unkown IP adresses on Internet by default (this include your new server IP adress of course).
If you choose 'smarthost' your server will have to connect to an existing (and trusted) mail server (gmail, yahoo, etc...) in order to forward its own e-mail messages.
This will ensure your e-mails get their ways up to their destination.
=== UPDATE
I had problem making it working with -t optin since some version of rails (3.2).
I had the following error in my /var/www/my_app/log/production.log :
Errno::ECONNREFUSED (Connection refused - connect(2) for "localhost" port 25)
So I removed the -t option as rails was not including anymore the To: field in the message and rather sent it in the command line.
I found some other developper having a similar issue on this app : gitlabhq
I hope this help people to make rails working with exim4.