Preparing Your System

You will need a few common items for the mail server configuration covered in this chapter, starting with the proper hardware. A personal mail server can easily run on a Pentium-class computer, although you may notice occasional slowdowns while incoming messages are being scanned. Disk space requirements depend mostly on how much mail you want to have room for, so plan on having a few gigabytes for the operating system (which will leave you plenty of extra, just in case), plus the amount of mail you want to store.

The operating system should be installed with only the basic set of packages before you begin these examples. Some general information about the installation is provided in Chapter 17. Although the software described in this chapter works even if you aren't running Ubuntu, the installation methods will not. If you don't have a spare system to act as a dedicated mail server, you can still use it as your workstation, although this is obviously recommended only for personal use.

Your network settings should also be properly configured before you begin installing the mail software. The exact requirements depend on the method by which mail will be delivered to your server:

• Direct delivery is the method used by most traditional mail servers. Mail records (MX) on your DNS server tell remote servers that any mail addressed to your domain should be sent to your server via SMTP.

• Retrieval from a mail host is also possible using an MRA (mail retrieval agent) such as Fetchmail. This option can be used when you have a mailbox under a shared domain but want to access the mail on your own server. This can also be done in combination with direct delivery if you have both your own domain and mailboxes under shared domains.

Note

Configuration of Fetchmail is explained in the "Configuring Mail Clients" section of this chapter. ■

Configuring DNS for direct delivery

For direct delivery to function, the SMTP service (TCP port 25) must be accessible to the outside world through a fixed name in DNS. This name will be in the form of an A (Address) record. "A" records allow DNS resolver processes to determine the IP address associated with a specific name and are used by most of the common protocols on the Internet. A typical DNS A record looks something like this:

bigserver.example.org IN A 10.0.12.16

The first parameter, bigserver.example.org, is the label, and the second parameter is the class (IN for Internet, which is where most DNS records are found). The A indicates the type, and the final parameter is the IP address associated with the label.

After you have your A record, you can direct mail to your server using an MX (Mail eXchanger) record. The A and MX records do not need to be part of the same domain, which allows for much greater flexibility. The following is a sample MX record:

widgets.test. IN MX 0 bigserver.example.org.

This MX record indicates that mail for any [email protected] should be sent through the server bigserver.example.org. The 0 indicates the numeric priority for this MX record. When more than one MX record exists for a given label, the MX with the lowest priority is tried first. If a temporary error is encountered, the next highest priority mail server is tried, and so on until the list is exhausted. At that point, the sending server will keep trying periodically until the message times out (generally five days). If multiple MX records exist with the same priority, they are tried in a random order.

Note

Most mail servers will also fall back on the IP address listed in the A record for a label in the event that no MX records exist. However, it is considered bad practice to rely on this feature. ■

In some cases, establishing an A record may be complicated because your IP address frequently changes. Obviously, this is not suitable for commercial purposes, but there is a workaround that is acceptably reliable for personal use. It is achieved through dynamic DNS services that are available (often at no charge) through a number of different companies. A list of these companies is maintained at http://www.dmoz.org/Computers/Internet/Protocols/DNS/ DNS_Providers/Dynamic_DNS/. Two of the most popular are

• ZoneEdit (www.zoneedit.com/)—Supported by the ez-ipupdate package

• No-IP (www.no-ip.com/)—Supported by the no-ip package

Note

The ez-ipupdate package supports both of these, plus a number of others. View the package description

(apt-cache show ez-ipupdate) for more information. ■

Most of these services will provide you with a hostname under a shared domain at no charge and can also provide a similar service for your own domain for a reasonable fee.

Configuring for retrieval from a mail host

The configuration requirements when retrieving mail from a mail host are pretty limited. Your server should be ready to accept mail addressed to localhost and should generally have a name that is unique to it. In the event that a message sent to one of your mailboxes is rejected, the server will need to have a valid hostname by which to identify itself when sending out the DSN (Delivery Status Notification).

You must be able to access the server from clients, although you may need to do so only from clients within your network. In either case, you should be familiar with the information about DNS and A records in the previous section.

Was this article helpful?

0 0

Post a comment