FORMAIL (1)
mail (re)formatter
SYNOPSIS
formail
[ \fB\+\fPskip ]
[ \fB-\fPtotal ]
[ -vbczfrktedqBY ]
[ -p
prefix ]
n .ti +0.5i
[ -D
maxlen idcache ]
n .ti +0.5i
[ -x
headerfield ]
[ -X
headerfield ]
n .ti +0.5i
[ -a
headerfield ]
[ -A
headerfield ]
n .ti +0.5i
[ -i
headerfield ]
[ -I
headerfield ]
n .ti +0.5i
[ -u
headerfield ]
[ -U
headerfield ]
n .ti +0.5i
[ -R
oldfield
newfield ]
n .ti +0.5i
[ -n
[ maxprocs
]]
[ -m
minfields ]
[ -s
[ command
[ arg
.\|.\|.\|]]]
DESCRIPTION
formail
is a filter that can be used to force mail into mailbox format, perform
`From ' escaping, generate auto-replying headers, do simple
header munging/extracting or split up a
mailbox/digest/articles file. The mail/mailbox/article contents will be
expected on stdin.
If formail is supposed to determine the sender of the mail, but is unable
to find any, it will substitute `foo@bar'.
If formail is started without any command line options, it will force any
mail coming from stdin into mailbox format and will escape
all
bogus `From ' lines with a `>'.
OPTIONS
NOTES
When renaming, removing, or extracting fields, partial fieldnames may
be used to specify all fields that start with the specified value.
By default, when generating an auto-reply header procmail selects the
envelope sender from the input message. This is correct for vacation
messages and other automatic replies regarding the routing or delivery
of the original message. If the sender is expecting a reply or the
reply is being generated in response to the contents of the original
message then the -t option should be used.
RFC822, the original standard governing the format of Internet mail
messages, did not specify whether Resent header fields (those that
begin with `Resent-', such as `Resent-From:') should be considered
when generating a reply. Since then, the recommended usage of the
Resent headers has changed to consider them as purely informational and
not for use when normally generating a reply. While formail now
ignores Resent headers when generating header replies, versions of
formail prior to 3.14 gave such headers a high precedence. If the old
behavior is needed for established applications it can be specified by
calling formail with the option `-a Resent-' in addition
to the -r and -t options. This usage is deprecated
and should not be used in new applications.
ENVIRONMENT
FILENO
While splitting, formail assigns the message number currently being output to
this variable. By presetting FILENO, you can change the initial message
number being used and the width of the zero-padded output. If FILENO is
unset it will default to 000. If FILENO is non-empty and
does not contain a number, FILENO generation is disabled.
EXAMPLES
To split up a digest one usually uses:
formail +1 -ds >>the_mailbox_of_your_choice
or
To remove all Received: fields from the header:
To remove all fields except From: and Subject: from the header:
formail -k -X From: -X Subject:
To supersede the Reply-To: field in a header you could use:
formail -i "Reply-To: foo@bar"
To convert a non-standard mailbox file into a standard mailbox file you can
use:
formail -ds <old_mailbox >>new_mailbox
Or, if you have a very tolerant mailer:
formail -a Date: -ds <old_mailbox >>new_mailbox
To extract the header from a message:
or
To extract the body from a message:
or
SEE ALSO
DIAGNOSTICS
Can't fork
Too many processes on this machine.
Content-Length: field exceeds actual length by nnn bytes
The Content-Length: field in the header specified a length that was longer
than the actual body. This causes this message to absorb a number of
subsequent messages following it in the same mailbox.
Couldn't write to stdout
The program that formail was trying to pipe into didn't accept all the data
formail sent to it; this diagnostic can be suppressed by the
-q
option.
Duplicate key found: x
The Message-ID or sender x in this message was found in the idcache; this
diagnostic can be suppressed by the
-q
option.
Failed to execute "x"
Program not in path, or not executable.
File table full
Too many open files on this machine.
Invalid field-name: "x"
The specified field-name "x" contains control characters, or cannot be a
partial field-name for this option.
No-wait option ignored to prevent corrupt idcache
The -n and -D options cannot be safely used together,
so the former was ignored.
WARNINGS
You can save yourself and others a lot of grief if you try to avoid using
this autoreply feature on mails coming through mailinglists. Depending
on the format of the incoming mail (which in turn depends on both the
original sender's mail agent and the mailinglist setup) formail could
decide to generate an autoreply header that replies to the list.
BUGS
When formail has to generate a leading `From ' line it normally will contain
the current date. If formail is given the option `-a Date:',
it will use the date from the `Date:' field in the header (if present).
However, since formail copies it verbatim, the format will differ from that
expected by most mail readers.
If formail is instructed to delete or rename the leading `From ' line, it
will not automatically regenerate it as usual. To force formail to regenerate
it in this case, include -a 'From '.
If formail is not called as the first program in a pipe and it is told to
split up the input in several messages, then formail will not terminate until
the program it receives the input from terminates itself.
If formail is instructed to generate an autoreply mail, it will
never
put more than one address in the `To:' field.
MISCELLANEOUS
Formail is eight-bit clean.
When formail has to determine the sender's address, every
RFC822
conforming
mail address is allowed. Formail will always strip down the address to
its minimal form (deleting excessive comments and whitespace).
The regular expression that is used to find `real' postmarks is:
"\en\enFrom [\et ]*[^\et\en ]+[\et ]+[^\en\et ]"
If a
Content-Length:
field is found in a header, formail will copy the number of specified bytes in
the body verbatim before resuming the regular scanning for message boundaries
(except when splitting digests or Berkeley mailbox format is assumed).
NOTES
Calling up formail with the -h or -? options will cause
it to display a command-line help page.
SOURCE
This program is part of the
procmail mail-processing-package
(v3.14) available at http://www.procmail.org/ or
ftp.procmail.org in
pub/procmail/ .
MAILINGLIST
There exists a mailinglist for questions relating to any program in the
procmail package:
If you would like to stay informed about new versions and official patches send
a subscription request to
procmail-announce-request@procmail.org
(this is a readonly list).
AUTHOR
|
|