table of contents
|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.
- Use only the command line arguments as recipient addresses. Ignore the header recipient lines.
- Use both the command line arguments and data from the message header as recipient addresses.
- Use either the command line arguments (if there are any) or data from the message header (if there are no arguments) as the recipient addresses.
- -f sender
- Set the envelope sender address to sender.
- Use only data from the message header as the recipient addresses.
- Do not queue the message, but print the reformatted contents to standard output.
- Print out the envelope (sender and recipient addresses) preceding the message when printing the message to standard output.
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:
- Use "address (comment)" style in the generated From field instead of the default "comment <address>" style.
- Ignore and remove any From header lines and always insert a generated one.
- Ignore and remove any Message-Id header lines.
- Ignore and remove any Return-Path header lines.
- Insert a To line containing a list of the recipients if the header does not contain either a To or a Cc field. If the message is determined to be a resent message (see above), a Resent-To field is added if the header does not contain either a Resent-To or a Resent-Cc field.
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.
- The content of this file is appended to any host name that does not contain a period (except localhost), including defaulthost and idhost. Defaults to the value of the /etc/mailname system file, if it exists, otherwise the literal name defauldomain.
- The content of this file is appended to any address that is missing a host name. Defaults to the value of the /etc/mailname system file, if it exists, otherwise the literal name defaulthost.
- The content of this file is used when building the message-id string for the message. Defaults to the canonicalized value of defaulthost.
- The fully-qualifiled host name of the computer running nullmailer. Defaults to the literal name me.
This document glosses over very many details of how address parsing and rewriting actually works (among other things).