Mail Delivery

Postfix uses the concept of address classes when determining which destinations to accept for delivery and how the delivery takes place. The main address classes are local, virtual alias, virtual mailbox, and relay. Destination addresses that do not fall into one of these classes are delivered over the network by the SMTP client (assuming it was received by an authorized client). Depending on the address class, the queue manager calls the appropriate delivery agent to handle the message.

3.4.1 Local Delivery

The local delivery agent handles mail for users with a shell account on the system where Postfix is running. Domain names for local delivery are listed in the mydestination parameter. Messages sent to a user at any of the mydestination domains are delivered to the individual shell account for the user. In the simple case, the local delivery agent deposits an email message into the local message store. It also checks aliases and users' .forward files to see if local messages should be delivered elsewhere. See Chapter 7 for more information on local delivery.

When a message is to be forwarded elsewhere, it is resubmitted to Postfix for delivery to the new address. If there are temporary problems delivering the message, the delivery agent notifies the queue manager to mark the message for a future delivery attempt and store it in the deferred queue. Permanent problems cause the queue manager to bounce the message back to the original sender.

3.4.2 Virtual Alias Messages

Virtual alias addresses are all forwarded to other addresses. Domain names for virtual aliasing are listed in the virtual_alias_domains parameter. Every domain has its own set of users that do not have to be unique across domains. Users and their real addresses are listed in lookup tables specified in the virtual_alias_maps parameter. Messages received for virtual alias addresses are resubmitted for delivery to the real address. See Chapter 8 for more information on virtual aliases.

3.4.3 Virtual Mailbox Messages

The virtual delivery agent handles mail for virtual mailbox addresses. These mailboxes are not associated with particular shell accounts on the system. Domain names for virtual mailboxes are listed in the virtual_mailbox_domains parameter. Every domain has its own set of users that do not have to be unique across domains. Users and their mailbox files are listed in lookup tables specified in the virtual_mailbox_maps parameter. See Chapter 8 for more information on virtual mailboxes.

3.4.4 Relay Messages

The smtp delivery agent handles mail for relay domains. Email addresses in relay domains are hosted on other systems, but Postfix accepts messages for the domains and relays them to the correct system. Relay configurations are common when Postfix accepts mail over the Internet and passes it to systems on an internal network. Domain names for relay domains are listed in the relay_domains parameter. See Chapter 9 for more information on relaying.

3.4.5 Other Messages

Messages that do not fit into one of the address classes are generally destined for other domains hosted elsewhere on the network. Postfix accepts such messages only from authorized clients, such as systems that run on the same local network. When a message has to be delivered across the network, the queue manager calls the smtp delivery agent. The smtp agent determines which host or hosts can receive the message and makes a connection to each in turn until it finds one to accept it. If there are temporary problems delivering the message, the smtp delivery agent notifies the queue manager to mark the message for a future delivery attempt and store it in the deferred queue. Permanent problems cause the queue manager to bounce the message back to the original sender.

When a destination system that has been unavailable comes back online, Postfix is careful not to overwhelm it with all its pending messages. Whether delivering previously deferred messages or new messages, Postfix, at first, makes only a limited (configurable) number of connections to a receiving system. After Postfix has detected successful deliveries to a particular site, it slowly increases (up to a configurable limit) simultaneous connections to it. If Postfix detects any trouble from the receiving site, it starts to back off deliveries immediately.

3.4.6 Other Delivery Agents

There are other Postfix delivery agents that can be configured to handle messages for a particular class or destination. Other delivery agents must be configured in the master.cf file. They are invoked either through the class_transport parameter or through an entry in a transport table, listed in the transport_maps parameter. Two common alternate delivery agents are the lmtp and pipe agents.

3.4.6.1 Delivery via LMTP

The LMTP protocol is similar to SMTP, but it is used for deliveries between mail systems on the same network. (See Chapter 7 for more information on LMTP.) For example, if a message has to be delivered to a different software package, which might be running on the same machine or another system on the local area network, the queue manager calls the lmtp delivery agent. The most common example for using LMTP is when a POP/IMAP server stores messages in a proprietary format. (Recall that POP and IMAP are protocols for users to retrieve their messages.) The POP/IMAP server, in this case, has its own proprietary format for storing messages, so Postfix uses the LMTP standard to hand off the message to the POP/IMAP server. If there are any problems delivering the message, the lmtp delivery agent notifies the queue manager to mark the message for a future delivery attempt and store it in the deferred queue.

3.4.6.2 Pipe delivery

Postfix offers the option of delivering messages to another program through the pipe daemon. The pipe daemon delivers messages to external commands. A common use for the pipe daemon is to have email delivered to an external content filter or another communications medium, such as a FAX machine. If there are any problems delivering the message, the pipe daemon notifies the queue manager to mark the message for a future delivery attempt and store it in the deferred queue.

Категории