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 the sendmail utility page in the TCP/IP 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 isn't. We provide a sample /etc/sendmail.cf that requires modification before it can be used.

At a minimum, you'll need to change 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 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 C (``A named Reference'') in TCP/IP Network Administration.

Post Office Protocol

In order for SMTP to deliver mail, a TCP connection must be made to the receiver host. Therefore, hosts that are intermittently network connected (such as a home computer that uses PPP to connect to an ISP) can't be used reliably for mail reception. To overcome this problem, the Post Office Protocol (POP) was developed.

POP requires that the user's mailbox is stored on the POP server (usually, an ISP). A POP client will then ``login'' on the POP server and retrieve any stored message. Depending on the POP client, messages can be read online (while the network connection is active) or all the messages can be copied to the client machine and read offline.

Although POP was developed primarily for mail reception, extensions to the protocol let you send mail as well. For more information, see popper in the TCP/IP Utilities chapter in this guide.


Note: The popper utility implements the POP server. A POP client isn't shipped with TCP/IP, but is shipped with Voyager.