Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 34 Next »

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 it is recommend to use a dedicated mail server. Non-profits or small businesses should consider the using Google Apps 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.

Basics of Postfix

Default installations of Postfix stores all messages in an mbox file. To see what directory it is using use the command,

sudo postconf mail_spool_directory
mail_spool_directory = /var/mail # This is the default directory.

The newer maildir format is now recommened so follow the next section to change to maildir.

Setup Mail Delivery Account

The overall consensus is to use the maildir format with a mail directory being used for each user.

main.cf

Backup /etc/postfix/main.cf in case something goes wrong. All the subsequent commands modify main.cf,

sudo cp /etc/postfix/main.cf /etc/postfix/main.cf.v0.0.bck

The following command will do make the following changes,

  • Set emails to the users home directory under a subfolder called Maildir.
  • The trailing slash indicating a folder, will configure Postfix to use the maildir format. Note, if you forge the slash, a file called maildir will be generated in mbox format.
sudo postconf -e 'home_mailbox = Maildir/'

In most cases, your system is being used to send email outbound and not receive email or deliver the emails locally to the system.

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

  • No labels