Setting up Mail

This chapter covers the following topics:

Internet mail

Mail moves between TCP/IP hosts via SMTP (the Simple Mail Transfer Protocol). The program that controls the movement of mail is sendmail, which will route mail over whatever networks are necessary to deliver it to the correct place.

Note that sendmail doesn't provide a user-friendly front end — it's used only to deliver preformatted messages.

You might want to link sendmail to the name smtpd, which simply tells sendmail that you'd like it to automatically set the -bd switch to run itself in daemon mode.

For more information on sendmail's command-line switches, see its man page in the Utilities chapter in this guide and Chapter 10 of TCP/IP Network Administration.

Configuration file

While the protocol itself is quite simple, the configuration file for the daemon that deals with the mail is not. We provide a sample /etc/sendmail.cf people should find suitable as is (except for some minor, site-specific modifications).

Generally, you should be able to use the sample file by simply changing the following:

The w class defines which hostnames you'll receive mail for. The D definition represents your site's domain name.

If you need to customize your sendmail configuration, we strongly encourage you to get a copy of Sendmail by Bryan Costales, O'Reilly & Associates (ISBN 1-56592-056-2). This book is often referred to as “the bat book” because of the picture on its cover.

Incoming mail

When sendmail receives Internet mail destined for a local user, it routes the mail into the user's mailbox file via the local delivery agent defined by the Mlocal line in the configuration file. By default this is mailx in QNX.

Once the mail is placed into this file, the user can use mailx (or another mail client that can read mbox format) to read the mail. Mailbox files are typically located in the /usr/spool/mail directory.

Outgoing mail

When mailx is used to send mail, it will examine the recipient names and look for one of the following characters:

  • @
  • !
  • %

If mailx finds one of those characters, it will pass the message off to a command called rmail. The rmail program is used by mailx to send remote mail. Generally, rmail will simply forward the mail on to sendmail for transmission via SMTP.

MX records

In network configurations where a Domain Name Server (DNS) is being used, mail-exchange records (MX records) can be used to define a series of preferred hosts to transmit mail to. MX records enable mail to be addressed to a specified domain without the need to resolve the route to the destination every time.

The sendmail program will try sending the mail to each one of the preferred hosts until it succeeds. You can think of these preferred hosts as post offices, where the mail gets sorted and then delivered via an appropriate route to its destination.

For more information on MX records, see Chapter 8 (“Configuring DNS Name Service”) and Appendix D (“named Reference”) of TCP/IP Network Administration.