GiH
GiH

Reputation: 14624

How does Actionmailer work without defining settings?

I'm working on a rails project and can't figure out how the mail system works.

On the production server there is postfix installed, so I'm assuming thats how the emails are being sent (actually the headers show that it is postfix sending out the emails). However, in the application under config > environment > production.rb, there is nothing defining how to send the mail. There are no smtp settings, there is nothing saying its using sendmail or postfix, but the mails are being delivered. So how does the production server know to use postfix? I ask because the development server is using sendmail, so will anything need to be changed here for this to work or should it work out of the box (because it doesn't)?

Upvotes: 1

Views: 1091

Answers (1)

GiH
GiH

Reputation: 14624

Ok, so I figured out what was wrong, feel free to comment if you think my answer is not sufficient though or you have any feedback!

I found out from here that "Delivery defaults to an SMTP server running on your localhost on port 25." So on my production server it was working because postfix was installed. Where I was confused was staging, why wasn't sendmail working. I assumed sendmail was installed thats why! When I typed which sendmail, I got a result, so I assumed it was sendmail, but when I ran telnet <myhostname> 25 I got Exim 4.71! So a new assumption, sendmail is installed but not configured or setup on port 25, and exim is, so exim is handling mail.

I'm using this on amazon ec2 and just assumed that when I setup my instance, since its linux, it would have a mail server ready like I had on production. Obviously that was not a good assumption and I've now configured properly my prod, and I will try to use exim for staging since its already there.

Upvotes: 2

Related Questions