SuperScript::Software::qtools

The replier program


Interface

In .qmail:
  | replier dir address prog
where dir is a directory, address is an email address, and prog is one or more arguments specifying a program to run.

For each email message it processes, replier changes the working directory to dir, executes prog with the same message on standard input, and forwards the standard output from prog to address.

replier adds a Mailing-List field to the message headers with the contents of dir/mailinglist. It rejects the message if there is already a Mailing-List field.

replier adds to the message all fields listed in dir/headeradd, followed by an appropriate Delivered-To line. replier deletes from the message any fields with names listed in dir/headerremove. replier performs its header editing on the output from prog.

If prog exits 0, then replier forwards the message to address and exits 99, so that further commands in .qmail are ignored. If prog exits 111, replier exits 111, so that delivery is retried later. If prog exits anything else, or does not exist, condtomaildir exits 0, so the rest of .qmail is processed.

If it encounters a permanent error in handling a message, replier exits 100. If it encounters a temporary error a message, 822headerfilter exits 111.

replier does not distribute bounce messages: if the environment variable $SENDER is set, and is either empty or #@[], then replier rejects the message.

To create a replier that handles email sent to an address, use replier-config.

Environment variables

replier supplies several environment variables to prog. The recipient address that caused message processing by replier has one of two forms: inlocal-request@domain, where inlocal matches the first line of dir/inlocal, or request@domain, when dir/inlocal has an empty first line. In either case, replier sets the following environment variables:

NB: These environment variables are not quoted. They are under the control of the sender.

$REQUEST is request in the recipient address.

$REQUEST2 is the portion of request in the recipient address that follows the first hyphen.

$REQUEST3 is the portion of request in the recipient address that follows the second hyphen.

$REQUEST4 is the portion of request in the recipient address that follows the third hyphen.