The local module

Support for delivering and originating messages on the local machine.

Configuration files

defaulthost - default hostname after the @. Defaults to me.

virtualdomains - virtual domains. Each line is of the form domain.tld<tab>user

mailbox - default user mailbox. If no .courier file, the message is delivered to this file or maildir, relative to the recipient's home directory.  local will also append the dash-extension (if any) to the name of the directory or file (trailing / should NOT be specified!). mailbox may also start with a |, to specify a program to pipe the message to.

The default default

As the last resort, local will attempt to deliver messages to:

A) maildrop, if maildrop is detected during compilation
B) procmail, if procmail is detected during compilation
C) $HOME/Mailbox

The following comments apply only when either procmail or maildrop are invoked under these condition. The following does not apply if procmail or maildrop are invoked from a .courier file, or from the mailbox configuration file.

procmail will be invoked with the -f flag. procmail will receive one argument: COURIER=x, where x is the dash-extension. If the local address is user-foo-bar, procmail will be run with COURIER=foo.  If there is no dash extension, procmail will be run with COURIER=-

maildrop ...

Shared library

rewritedel - if domain is listed in locals or virtualdomains, will accept delivery. If domain is in virtualdomains, prepends 'user-' to the local part of the address, then works with the local part from then on. If the local part is a valid userid, accepts delivery, otherwise if the local part is user-foo, strips off the foo, and tries again to check for the valid userid. If a valid userid is found, after stripping one or more portions, takes what was removed, "-foo", or maybe even "-foo-bar", prepends ".courier", and checks if the file exists in user's home. If not, error, mailbox not found. Otherwise the 'host' parameter is the userid, and the 'address' parameter is the extension of the courier file, or just a "-" for $HOME/.courier.

Rewrite function:

local - calls local.defaulthost, unless address contains exclamation marks.
local.defaulthost - appends @defaulthost, if domain name is missing.

Output module

setuids to the user indicated in the host parameter.</\p>

attempts to open and read delivery instructions from .courier file specified by the address parameter. If can't open the file, or if it's empty, message is delivered to the default mailbox. Delivery instructions are read, a line at a time. Lines ending with \ are concatenated with the next one. A delivery instruction may specify a mailbox, a forwarding address !user@host, or a program delivery |

The output module appends a Delivered-To: userid-ext@defaulthost header. If the header already exists, the message is bounced as a mailing loop.

Input module

A soft link is installed from bin/sendmail (ho-ho) to lib/local/sendmail. sendmail is setgid-ed to mail, and is a wrapper for bin/submit. If called with the -bs flag, an attempt to run bin/smtpd is made.