Local Delivery

All destination domains that should be handled by the local transport should be listed in the mydestination parameter. You can list as many domains as you like, but individual local users receive mail at all of the domains listed. For example, if both ora.com and oreilly.com are listed in mydestination, then messages to either kdent@ora.com or kdent@oreilly.com go to the same local mailbox.

All local recipients should be listed in tables configured in the local_recipient_maps parameter to avoid accepting messages for unknown users. By default, local_recipient_maps is set to the system password file and alias maps, so you normally don't have to make any changes. Once Postfix has determined that it is the final destination for a message, and that the message should be delivered locally, it has to decide what to do with the message.

Before looking for a user account that matches the local part of the email address, Postfix consults its alias maps (see Chapter 4). If there is a forwarding alias that matches the recipient address, Postfix resubmits the message as a new delivery, based on the forwarding information from the alias lookup. Otherwise, it tries to deliver the message to a user on the system. Postfix first checks for the existence of a .forward file for the local user, and may resubmit the message based on information there. If no .forward exists for the user, Postfix delivers the message to the user's mailbox.

7.3.1 .forward Files

.forward files allow local users to set up their own aliases. The contents of the .forward file are the same as the righthand side of an alias entry. When an alias entry has multiple values on the righthand side, they are separated by commas; while .forward files use the same convention, they also allow multiple entries to be entered on multiple lines.

.forward files must be owned by the recipient, and are normally found in users' home directories. You can specify different locations with the forward_path parameter. When specifying a path for the parameter, there are eight variables whose values are expanded at delivery time:

$user

Recipient username as specified in /etc/passwd

$home

Recipient home directory as specified in /etc/passwd

$shell

Recipient shell as specified in /etc/passwd

$recipient

The complete recipient email address

$extension

An optional extension of a local part of the recipient address, separated by a delimiter such as the + character

$domain

Domain from the recipient email address

$local

Complete local part of recipient email address (includes extensions if any)

$recipient_delimiter

Delimiter character from the recipient email address, if there is an extension

If you want to add support for a nonstandard .forward file, you could configure forward_path as follows:

forward_path = /home/$user/.forward /home/$user/other_forward

See the Postfix local manpage for more information on specifying paths with variable expansion.

7.3.2 Alias Deliveries

When Postfix delivers to a command or file specified in alias files, it makes the delivery or executes the command as the user who owns the alias file. The exception is when the file is owned by root, in which case Postfix uses the account specified in the default_privs parameter. By default it is set to the account nobody. Aliases are discussed in Chapter 4.

7.3.3 Mailbox Delivery

When Postfix delivers a message to a local user, it writes the message to the system's message store. By default Postfix uses the mbox format for deliveries. When you install Postfix, it can normally figure out the default location of the mail spool directory depending on the type of Unix system you have. The mail_spool_directory parameter can be used to specify a directory other than the default. To change the directory to something other than the default for your system, edit the main.cf file, and add or modify the mail_spool_directory parameter:

mail_spool_directory = /var/spool/mail

To cause Postfix to use the maildir format for delivery, append the directory with a trailing slash:

mail_spool_directory = /var/spool/mail/

Postfix can also be configured to deliver messages to mailboxes within users' home directories. Assign a relative path to the home_mailbox parameter to indicate which file should be used for mailboxes:

home_mailbox = mbox

Append the path with a trailing slash to indicate that Postfix should use the maildir-style delivery:

home_mailbox = maildir/

This causes Postfix to deliver messages into a directory called maildir, below users' home directories.

With maildir-style delivery, Postfix normally creates the necessary directories and files, if the user's credentials permit it; however, as a security precaution, if the parent directory is world-writable, Postfix delivery agents will not create any additional files or directories.

Категории