I often launch CentOS images on ec2, specifically the RightImage_CentOS_6.3_x64_v184.108.40.206_EBS (ami-3b7bfc52). It’s a great clean CentOS image if you need to run tests or install Kaltura on a clean machine.
A common requirement is to have an email sending service, preferably postfix that will be stable and handle long queues of emails (to support for email notifications or alerts).
According to this thread on the AWS forums, mainly to block spam, ec2 servers are by default blocked from directly sending mail over port 25. So you’re mainly left with two options:
- Get a domain name, and email Amazon to enable email sending from your ec2.
- Signup for a service such as SendGrid.com or Amazon’s SES. (See a comparison matrix of various email services).
I preferred SendGrid for simplicity and since their free tier provides free 200 emails/day.
To signup, visit: https://sendgrid.com/user/signup, new accounts are usually enabled within 5 hours.
Configure sSMTP to relay via SendGrid
The default mail service on CentOS will be ssmtp. If you need to get an email working quickly, and don’t expect significant email queues, that might be a good option. ssmtp is abandoned since 2011, so you might want to jump to the postfix section if you care for a more stable solution.
Then edit/add the following settings (replace with your SendGrid user and pass):
To test, execute:
Configure Postfix to relay via SendGrid
A better option is to install Postfix, and set it to relay emails via SendGrid.
At the end of the file, add the following lines (replace with your SendGrid user and pass):
Run the following commands (which will initialize the mail aliases db and restart Postfix):
Lastly, configure MTA to choose Postfix by default (select the Postfix option and press enter):
Send a test mail:
Check the log file for any errors:
If you see no errors (and you shouldn’t) in the log, your message should successfully arrive at firstname.lastname@example.org.