With the -n option, new-inject prints the message rather than feeding it to qmail-queue.
See http://pobox.com/~djb/proto/immhf.html for a complete description of the Internet mail message header format.
The FIMRS options can be set as letters inside the $QMAILINJECT environment variable.
If new-inject is printing the message rather than feeding it to qmail-queue, it prints an Envelope-Sender field and an Envelope-Recipients field at the top of the new message header.
With the -a option, new-inject builds the envelope recipient list from the argument recipients, i.e., all recip addresses listed on the command line. With the -h option, new-inject builds the envelope recipient list from the header recipients, i.e., all addresses listed in the incoming message under Envelope-Recipients, or under To, Cc, Bcc, and Apparently-To if Envelope-Recipients is not supplied. With the -H option, new-inject uses both argument recipients and header recipients. With the (default) -A option, new-inject uses argument recipients, or header recipients if there are no argument recipients.
The envelope sender is set by the -f option if it is supplied; otherwise, the incoming Envelope-Sender field, if there is one; otherwise, the incoming Return-Path field, if there is one, and if the -S option is not set; otherwise, the default envelope sender, as described below. Incoming Envelope-Sender and Return-Path fields are removed in any case.
The default envelope sender contains a user name, a per-message VERP, a per-recipient VERP, and a host name. The user name is set by an environment variable: $QMAILSUSER, $QMAILUSER, $MAILUSER, $USER, or $LOGNAME, whichever comes first. If the -M option is set, the per-message VERP contains a dash, the current time, and the process ID; otherwise it is empty. If the -R option is set, the per-recipient VERP contains a dash, the envelope recipient user name, an equals sign, and the envelope recipient host name; otherwise it is empty. (If there are several recipients, each recipient sees a different sender address.) The host name is set by $QMAILSHOST, $QMAILHOST, $MAILHOST, or the empty string, subject to rewriting.
new-inject removes all incoming Bcc and Apparently-To fields.
If the incoming message does not contain a From field, new-inject creates a new From field.
If the -F option is set, new-inject discards any incoming From field, and creates a new From field.
The new From field contains a personal name, a user name, and a host name. The personal name is set by $QMAILNAME, $MAILNAME, or $NAME, whichever comes first; if none of these variables are set, the personal name is omitted. The user name is set by $QMAILUSER, $MAILUSER, $USER, or $LOGNAME. The host name is set by $QMAILHOST, $MAILHOST, or the empty string, subject to rewriting.
If the environment variable $QMAILMFTFILE is set, new-inject reads a list of mailing list addresses, one per line, from that file. If To+Cc includes one of those addresses (without regard to case), and if the incoming message does not contain a Mail-Followup-To field, new-inject adds a Mail-Followup-To field with all the To+Cc addresses.
Otherwise new-inject makes a new Date field with the current time in UTC, counting leap seconds.
If the -I option is set, new-inject discards any incoming Message-ID field, and creates a new Message-ID field.
new-inject uses the control file idhost (overridden by he environment variable $QMAILIDHOST; defaulting to me) in its new Message-ID field. idhost need not be the current host's name. It is your responsibility to obtain authorization from the owner of the idhost domain.
new-inject discards incoming Content-Length fields.