I got things working on the server with Dickson's help.
However, that leaves some things not documented and maybe somethings not needed.
Go over this again with Roderick on a new VM.
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
For mail name enter a domain name that you actually own and that is associated with the server. In our example, krypton.com.
This value will be entered into the file /etc/mailname.
At this point programs programs on your system will be able to start sending emails.
Setup Mail Delivery Account
Is this really necessary?
sudo addgroup --gid 3001 mailadmin sudo useradd -d /home/mailadmin -m -g mailadmin -u 3001 -c "Mail Admin catch-all" -s /bin/false mailadmin
main.cf
Backup /etc/postfix/main.cf in case something goes wrong. All the subsequent commands modify main.cf.
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.
Look up how to do via postconf -e here for consistency.
More commands,
sudo postconf -e "inet_interfaces = loopback-only" # receive no mail from the network, and do not deliver any mail locally
Reverse DNS
Reverse DNS unless delegated is managed by the ISP provider. Generally this means whoever manages the IP address of your server.
Setup spf Records
This section should be filled out with a general discussion of what spf is for and how to configure within Rackspace or your registrar.
Test
Here is how to send a test email.
First install a simple mail program. In this example we will use mailx,
sudo apt-get install bsd-mailx
Next send the email,
echo "test" | mail -s testsubject bhitch@imagecomics.com
The log for a valid send will look something like this,
tail /var/log/mail.info Jun 23 22:06:38 krypton postfix/pickup[15174]: AA67C2F824D: uid=2500 from=<tinpham> Jun 23 22:06:38 krypton postfix/cleanup[15988]: AA67C2F824D: message-id=<20110624020638.AA67C2F824D@myra> Jun 23 22:06:38 krypton postfix/qmgr[15175]: AA67C2F824D: from=<bhitch@krypton.com>, size=294, nrcpt=1 (queue active) Jun 23 22:06:39 krypton postfix/smtp[15990]: AA67C2F824D: to=<bhitch@rogers.com>, relay=mx1.rog.mail.yahoo.com[98.139.214.154]:25, delay=1, delays=0.02/0.01/0.25/0.74, dsn=2.0.0, status=sent (250 ok dirdel) Jun 23 22:06:39 krypton postfix/qmgr[15175]: AA67C2F824D: removed
If you do not see your receive your test email, try looking in your spam folder.
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