Specifies actions to be taken when mail is received.
The $HOME/.maildelivery file contains a list of actions the slocal command performs on received mail. The slocal command reads the $HOME/.maildelivery file and performs the specified actions when you activate it.
Specify your own mail delivery instructions in the $HOME/.maildelivery file. Each line in the $HOME/.maildelivery file describes an action and the conditions under which the action should be performed. The following five parameters must be present in each line of the file. These parameters are separated by either commas or space characters:
Blank lines in the .maildelivery file are ignored. A # (pound sign) in the first column indicates a comment. The file is read from beginning to end, so several matches can be made with several actions. The .maildelivery file should be owned by the user, and the owner can be the only one with write access.
If the $HOME/.maildelivery file cannot be found or does not deliver the message, the /etc/mh/maildelivery file is used in the same manner. If the message has still not been delivered, it is put in the user's mail drop. The default mail drop is the /usr/mail/$USER file.
The MH package contains four standard programs that can be run as receive-mail hooks: the rcvdist, rcvpack, rcvstore, and rcvtty commands.
Item | Description |
---|---|
Field | Specifies a header component to be searched for a pattern
to match the Pattern parameter. Specify one of the following
values for the Field parameter:
|
Pattern | Specifies the character string to search for in the header
component given by the Field parameter. For example, if you
specified From in the Field parameter, the Pattern parameter might contain an address like sarah@mephisto.
The Pattern parameter is not case-sensitive. The character string matches any combination of uppercase and lowercase characters. Specify a dummy pattern if you use an * (asterisk) or specify default in the Field parameter. |
Action | Specifies an action to take with the message if it contains
the pattern specified in the Pattern parameter. Specify the
following values:
|
Result | Indicates how the action should be performed. You can specify
one of the following values for this parameter:
|
"String" | Specifies the file to which the message can be appended if
you use the file value for the Action parameter. If you use the pipe or the qpipe value, the "String" parameter specifies the command to execute. If you use the destroy value as the Action parameter, the "String" parameter is not used, but you must still include a dummy "String" parameter. |
From george file A george.mail
This example directs the slocal command to search the From header line in messages. When the slocal command finds a
message from george, it files the message in a file called george.mail.addr manager > R proj_X/statlog
This example directs
the slocal command to search the address fields in messages.
When it finds a message for the project manager, the slocal command files a copy of the message in a file called proj_X/statlog. The original message is not considered delivered (the R value), so the message is still treated as mail and you will be
notified as usual.* - | R "/usr/lib/mh/rcvtty /home/sarah/allmail"
In this
example, the /home/sarah/allmail file contains the line:
echo "You have mail\n"
The /home/sarah/allmail file must have execute permission. When you have mail, the words You have mail are displayed on your console.addr manager | A "/usr/lib/mh/rcvdist amy"
This example directs the slocal command to search the address
fields in messages. When it finds a message to the project manager,
the slocal command sends a copy of the message to amy. The original message is not affected. The action is always performed
(the A value). The command that the slocal command
reads to distribute the copy to another user is the rcvdist command.default - > ? mailbox
This example directs the slocal command to find all undelivered
messages. The - (dash) is a placeholder for the Pattern parameter. The > (greater than sign) instructs the slocal command to file the messages it finds. The ? (question
mark) instructs the slocal command to respond only to undelivered
messages. The name of the file to store undelivered messages is mailbox.Item | Description |
---|---|
$HOME/.forward | Searched by the sendmail command when mail is received, contains either the path of a machine to which to forward mail or a line to start the slocal command. |
/usr/mail/$USER | Provides the default mail drop. |
/usr/lib/mh/slocal | Contains the slocal command that reads the .maildelivery file. |
/etc/mh/maildelivery | Contains the mail delivery instructions that the slocal command reads if none are specified in the $HOME/.maildelivery file. |
$HOME/.maildelivery | Specifies mail-related actions for the slocal command to perform. |