The way that qmail delivers local mail is fundamentally quite simple but is extremely configurable. This chapter looks in detail at the way that local mail is delivered, then looks at some common problems and applications.
Every local message is delivered to the local part of its target address, the part of the address to the left of the at-sign. The local part may come directly from an incoming message, or it may be generated internally by qmail, particularly for mail to virtual domains (see Chapter 12), which construct the local part from a combination of the incoming address and information about the virtual domain.
If the local part of an address contains one or more hyphens, the part before the first hyphen is consider the user and the rest is the extension. If the local part doesn’t contain a dash (hyphen), the local part is the user and there’s no extension.
The first step in a local delivery is to identify the user corresponding to the local part and retrieve several items about the user. The items are:
Username, that is, the login name that is usually but not necessarily the same as the qmail user.
The numeric user ID.
The numeric group ID.
The home directory.
The dash character, if the local part had an extension. This is almost always an actual dash, although for maximum sendmail compatibility some people use a plus sign instead.
The extension, usually the extension from the local part.