Often application need to deliver mail. It is also useful for alerts.
This article outlines specifically how to use your server to send emails. Another term for this is setting up a null client. For receiving emails and hosting we recommend a dedicated mail server or for non-profits or small businesses to setup their domain name with Google which is free.
Install and Configure Postfix
Postfix is free and open-source mail transfer agent (MTA) that routes and delivers electronic mail. It is intended as a fast, easier-to-administer, and secure alternative to the widely-used Sendmail MTA.
sudo apt-get install postfix
Then select the following options,
- Internet site
krypton.com
Setup Mail Delivery Account
sudo addgroup --gid 3001 mailadmin sudo useradd -d /home/mailadmin -m -g mailadmin -u 3001 -c "Mail Admin catch-all" -s /bin/false mailadmin
Next we select the format for storing emails which will be Maildir,
sudo postconf -e 'home_mailbox = Maildir'
This sets mail in /home/username/Maildir and the MDA (Mail Delivery Agent) must be set to the same path.
If we want multiple domains, for example, earth.com, just add it to the list by editing /etc/postfix/main.cf and adding earth.com to the mydestination line.
More commands,
sudo postconf -e "inet_interfaces = loopback-only" # receive no mail from the network, and do not deliver any mail locally
Setup MX Records
This section should be filled out with a general discussion of what MX is for and how to configure within Rackspace.
Test
Here is how to send a test email,
echo "test" | mail -s testsubject bhitch@imagecomics.com
References
https://help.ubuntu.com/10.04/serverguide/C/postfix.html - How to setup postfix
http://www.linuxmail.info/mbox-maildir-mail-storage-formats/ - Deciding on Mbox vs Maildir
http://www.tummy.com/Products/vpostmaster/recipes/dovecotsasl.html - Syrus vs Dovecot
http://articles.slicehost.com/2010/3/1/barebones-postfix-install-for-ubuntu - Slicehost instructions on postfix, has notes here about reverse dns being needed
http://cloudservers.rackspacecloud.com/index.php/Postfix_-_Basic_Settings_in_main.cf - Rackspace instructions on postfix, the Slicehost actually seems better
http://www.postfix.org/STANDARD_CONFIGURATION_README.html - talks about null client