Guide to Unix/Explanations/Mail Server Overview/Mail Retrieval Agent
The Mail Retrieval Agent software retrieves email messages from remote mail servers, and works with the mail delivery agent to deliver mail to the local maildirs.
Operation of the mail retrieval agent
editOn a typical mailserver, the task scheduler is configured to run the mail retrieval agent for each of the users that are able to retrieve mail.
Explicit delivery mode
editSome systems use a mail retrieval agent that supports explicit delivery mode, enabling the contents of multiple mailboxes to be retrieved from a single instance of the mail retrieval agent. On these systems, the mail retrieval agent passes the username of the recipient to the intermediate script.
The intermediate script
editThe intermediate script sets the environment variables and passes appropriate parameters to the mail delivery agent. The intermediate script sets environment variables and passes appropriate parameters to the mail delivery agent.
Username switching
editOn systems where the mail delivery agent does not support explicit delivery mode, the intermediate script may perform username switching as mail is retrieved. This is because the mail delivery agent traditionally expects to be invoked as the intended recipient. The mail retrieval agent is being run by the as a virtual user and the mail is to be delivered to mutiple real recipients, so the intermediate script has to make username and environment switches, so that the mail delivery agent can make the delivery to the appropriate mailboxes.