Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I just got started with an EC2 instance and got my mail sending limit removed, allowing me to send emails from my instance. But due to lack of experience, I have no clue on how to enable receiving emails send to me on that server.

The instance has an elastic IP and I have a domain name with an A record pointing to that IP. I cant seem to find better documentation on what steps need to be taken so if someone sends an email to info@mysite.com it either actually receives it or simply forwards it to my personal email.

I know that it involves using postfix but cant find a guide to properly configure it after the installation.

Thanks

share|improve this question
1  
You probably also want an MX record in addition to or instead of the A record. –  wfaulk May 4 '12 at 22:03

4 Answers 4

up vote 6 down vote accepted
  • A record that points to your server.
  • MX record that points to your A record.
  • Mail daemon listening on port 25 -- I tend towards Postfix.
  • Firewall rules allowing port 25 to accept connections. On EC2, you need to set this in your security groups
share|improve this answer

You'll need an SMTP daemon such as postfix installed, and thus, the ports open from the AWS security group for starters.

Then, you can follow a configuration guide - have a look at the postfix basic configuration guide.

In a nutshell, you'll want to be 100% sure you're not operating as an open rely. Here's a very basic main.cf for simple username based delivery that I use:

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no

myhostname = mail.domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

mydestination = hostname.domain.com, localhost.mydomain.com, localhost
relayhost =
mynetworks = 127.0.0.0/8
#mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all


smtpd_helo_restrictions =
    permit_mynetworks,
    #reject_non_fqdn_hostname,
    reject_invalid_hostname,
    permit
share|improve this answer

I was facing similar problems. I have an MX record set up and the ports unblocked in the security policies, but a port scan still shows port 25 as blocked.

I came across this answer on the AWS forum. It seems that you have to request to specifically unblock your port 25 / 445. http://mxtoolbox.com/ should be useful to test your server.

share|improve this answer

It's also worth noting that sending email directly from ec2 instances will likely result in them being marked as spam.

Use the SES service from amazon to get around this - but also note that there are known bugs in that system.. such as mac osx default mime type for jpeg images being blocked.

If you're able to have mail somewhere else, I would do that as it can become a pain to implement workarounds for stupid SES "features".

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.