UNIX System Administration Handbook - Evi Nemeth [320]
The idea is to use the MSA, which runs on a different port, as a sort of “receptionist” for new messages injected into the mail system by local user agents. The MSA does all the prep work and error checking that must be done before a message can be sent out by the transport agent. It’s a bit like inserting a sanity checker between the MUA and the MTA.
In particular, the MSA ensures that all hostnames are fully qualified; it verifies that local hostnames are legitimate before adding the local domain portion. The MSA also fixes message headers if they are missing or nonconformant. Often, the MSA adds a From or Date header or adjusts the Message-Id header. One final chore that an MSA can do is to rewrite the sender’s address from a login name to a preferred external form such as First_Last.
To make this scheme work, user agents must be configured to connect to the MSA on port 587 instead of to port 25, which is the traditional port for mail. If your user agents cannot be taught to use port 587, you can still run an MSA on port 25, but on a different server from your MTA. You must also configure your transport agent so that it doesn’t duplicate the work done by the MSA. Duplicate processing won’t affect the correctness of mail handling, but it does represent useless extra work.
sendmail can act as an MSA as well as an MTA. As of sendmail 8.10, the MSA service is turned on by default. This configuration is set up with the nocanonify feature and DAEMON_OPTIONS; see pages 579 and 588 for details. When sendmail is acting as both an MTA and an MSA, it provides each service on a different network port: port 25 for MTA service and port 587 (by default) for MSA service.
19.2 THE ANATOMY OF A MAIL MESSAGE
A mail message has three distinct parts that we must understand before we get embroiled in sendmail configuration:
• The envelope
• The headers
• The body of the message
The envelope determines where the message will be delivered or, if the message can’t be delivered, to whom it should be returned. These addresses generally agree with the From and To lines of the header, although they are supplied separately to the MSA. The envelope is invisible to users; it’s used internally by sendmail to figure out where to send the message.
The headers are a collection of property/value pairs formatted according to RFC822. They record a variety of information about the message, such as the date and time at which it was sent and the transport agents through which it passed on its journey. The headers are a bona fide part of the mail message, although user agents often hide some of the less interesting ones when displaying messages for the user.
The body of the message is the actual content to be sent. It must consist of plain text, although that text often represents a mail-safe encoding of various binary content.
As we get into the configuration section, we sometimes speak of the envelope sender and recipients and sometimes speak of the header sender and recipients. We try to specify which addresses we are referring to if it’s not clear from the context.
Mail addressing
Local addressing is simple because a user’s login name is a unique identifier. But when an addressee does not have an account on the local machine, addressing and delivery are a bit more complicated.
There are basically two kinds of email addresses: route based (relative) and location independent (absolute). Route-based addressing requires the sender to know the intermediate machines through which a message should travel to reach its destination. Location-independent addressing simply identifies the final destination.