nullmailer-inject(1) | General Commands Manual | nullmailer-inject(1) |
nullmailer-inject - Reformat and inject a message into the queue.
nullmailer-inject [-a] [-b] [-e] [-f sender] [-h] [recipient [recipient ...]]
This program reads a email message from standard input, reformats its header to comply with RFC822, and sends the resulting message to the queue.
The following lines are parsed for recipient addresses: To, Cc, Bcc, Apparently-To, Resent-To, Resent-Cc, and Resent-Bcc.
The following sender address lines are parsed and rewritten: Sender, From, Reply-To, Return-Path, Return-Receipt-To, Errors-To, Resent-Sender, Resent-From, and Resent-Reply-To. If the Return-Path header field is present and contains a single address, its contents will be used to set the envelope sender address.
If the message contains any of the following fields, it is treated as a resent message: Resent-Sender, Resent-From, Resent-Reply-To, Resent-To, Resent-Cc, Resent-Bcc, Resent-Date, Resent-Message-ID. If the message is resent, only the recipient fields prefixed with Resent- are examined for addresses.
Any occurrences of Bcc, Resent-Bcc, Return-Path, or Content-Length are discarded after they are parsed (if necessary).
If the header lacks a Message-Id field, a unique string is generated and added to the message. If the header lacks a Date field, the current local date and time in RFC822 format is appended to the message. If the message has no To or Cc fields, the following line is appended to the message:
Cc: recipient list not shown: ;
Address lists are expected to follow the syntax set out in RFC822. The following is a simplified explanation of the syntax.
An address list is list of addresses separated by commas. An individual address may have one of the following three forms: user@fqdn, comment<user@fqdn>, or phrase:address-list;. Any of the first two forms may be used within the address list of the third form. Any word containing special characters must be placed in double quotes and the special characters must be preceded with a backslash. Comments may be placed between addresses in parenthesis. All comments are ignored.
Addresses lists are reformatted as they are parsed for ease of later re-parsing when the message reaches the destination(s). If an address is missing a fqdn, nullmailer-inject adds one.
Exits 0 if it was successful, otherwise it prints a diagnostic message to standard error and exits 1.
The environment variable NULLMAILER_FLAGS is parsed and the behavior of nullmailer-inject is modified if any of the following letters are present:
The user name is set by NULLMAILER_USER, MAILUSER, USER, or LOGNAME, whichever comes first. If none of the above are set the name is taken from the password file, or set to unknown if that fails.
The host name is set by the canonicalized value of NULLMAILER_HOST, MAILHOST, or HOSTNAME, whichever comes first, or the defaulthost config file if none of the above are set (see below).
The full name of the user is set by NULLMAILER_NAME, MAILNAME, NAME, or the user name above, whichever comes first.
The user and host name of the envelope sender default to the user and host name set above, but may be overridden by NULLMAILER_SUSER and NULLMAILER_SHOST.
If NULLMAILER_QUEUE is set, the program named is used in place of nullmailer-queue to queue the formatted message.
When reading the following files, a single line is read and stripped of all leading and trailing whitespace characters.
This document glosses over very many details of how address parsing and rewriting actually works (among other things).