user delivery specification file
field FS pattern
FS action FS result
FS filename [ arg ... ]
The delivery of mail by the local channel can run through various
courses, including using a user-tailorable file.
The delivery follows the following strategy, giving up at any point
it considers the message delivered:
If the address indicates a pipe or file default, then that is carried out.
The file .maildelivery
in the home directory is read if it exists and the actions in it are followed.
A system-wide file,
is read if it exists and the actions in it are followed.
This file must by owned by root.
The user's .maildelivery takes precedence over the
If the message still has not been delivered, then it is put into
the user's normal mailbox.
The five fields of a maildelivery file are:
is name of a field that is to be searched for a pattern.
This is any header field that you might find in a message.
The most commonly used headers are: From, To, cc, Subject and Sender.
As well as the standard headers, there are some pseudo-headers
that can also be used. These are:
The out-of-band sender information. This is the address MMDF would
use for reporting delivery problems with the message.
The address that was used to mail to you, normally yourname or
yourname=string (see below).
If the message has not been delivered yet, this field is matched.
This case is always true regardless of any other action.
is some sequence of characters that may be matched in the above
field. Case is not significant.
is one of the mail delivery actions supported by the local channel.
Currently supported actions are:
Append the message to the given file in the
Start up a process defined by the filename field with the
message taken as its standard input. Messages are prefixed with
Throws the message away.
For piped commands, the exit status of the command is significant.
An exit status of 0 implies that the command succeeded and everything
went well. An exit status of octal 0300-0377 indicates that a permanent
failure occurred and the message should be rejected.
Any other exit status indicates a temporary failure and the delivery
attempt will be aborted and restarted at a later time.
is one of the letters A, R or ? which stand for
Accept, Reject and ``Accept if not delivered yet''.
They have the following effects:
If the result of this line's action is OK, then the message can be
The message is not to be considered delivered by this action.
This is equivalent to A except that the action is not carried
out if the message has already been accepted.
filename [ arg ... ]
Used in conjunction with the action field:
If action is file or >,
set to the name of a file to be appended with the message.
If action is pipe or |,
set to the name of a command (with optional arguments)
to process the message.
See the ``Built-in variables'' section for details of the
information that can be passed to a piped program.
If action is set to destroy,
set to a dash (-).
The field separator character (FS) can be a tab, space or
These characters can be included within a field by quoting them with
double quotes ("); double quotes can be included preceded by a
The file is always read completely so that several matches
can be made, and several actions taken.
As a security check, the .maildelivery file must be owned by either
the user or root, and must not have group or general
write permission. In addition the system delivery file has the above
restrictions but must also be owned by root.
If the field specified does not need a value, a dash (-),
or similar symbol is usually inserted to show that the field is present
but not used.
MMDF treats local addresses that contain an equal sign (=)
in a special manner. Everything in a local address
from an equal sign to the ``@'' is ignored and passed on to the
local channel. The local channel will make the entire string available
for matching against the ``addr'' string of the MMDF file.
For example, if you were to subscribe to a digest as ``foo=digest@bar.NET'',
the submit command
and the local channel will verify that it is legal to deliver
to ``foo'', but then the entire string ``foo=digest'' will be available
for string matching against the contents
of the .maildelivery file ``addr'' field.
The environment in which piped programs are run
contains a few standard features, specifically:
Set to the user's home directory.
Set to the user's login name.
Set to the user's login shell (defaults to /bin/sh).
The default umask is set to 077 (a very protective creation mask).
A shell script can be run first to set up more complex environments.
There are certain built-in variables that you can give
as the arguments (args) to a piped program:
Pipe actions that expand to nothing are replaced with an empty argument.
The address that was used to mail to you,
normally `yourname' or `yourname=string'.
The info field from the internal mail header;
probably only of interest to system administrators.
The ``Reply-To:'' field (or the ``From:'' field
if the former is missing); this can be used for automatic replies.
The return address for the message.
The size in bytes of the message.
This is an example of what a typical maildelivery file
# lines starting with a ``#'' are ignored.
# as are blank lines
# file mail with mmdf2 in the "To:" line into file mmdf2.log
To mmdf2 file A mmdf2.log
# Messages from mmdf pipe to the program err-message-archive
From mmdf pipe A err-message-archive
# Anything with the "Sender:" address "uk-mmdf-workers"
# file in mmdf2.log if not filed already
Sender uk-mmdf-workers file ? mmdf2.log
# "To:" unix - put in file unix-news
To Unix > A unix-news
# if the address is jpo=mmdf - pipe into mmdf-redist
Addr jpo=mmdf | A mmdf-redist
# if the address is jpo=ack - send an acknowledgement copy back
Addr jpo=ack | R resend -r $(reply-to)
# anything from steve - destroy!
from steve destroy A -
# anything not matched yet - put into mailbox
default - > ? mailbox
# always run rcvalert
* - | R rcvalert
the system file
MMDF is not part of any currently supported standard; it was developed at
the University of Delaware and is used with permission.
© 2004 The SCO Group, Inc. All rights reserved.