Penguin
Annotated edit history of formail(1) version 3, including all changes. View license author blame.
Rev Author # Line
1 perry 1 !!NAME
2 formail - mail (re)formatter
3 !!SYNOPSIS
2 PerryLorier 4 __formail__ [[__+__''skip''] [[__-__''total''] [[__-bczfrktedqBY__] [[__-p__ ''prefix''] [[__-D__ ''maxlen idcache''] [[__-l__ ''folder''] [[__-x__ ''headerfield''] [[__-X__ ''headerfield''] [[__-a__ ''headerfield''] [[__-A__ ''headerfield''] [[__-i__ ''headerfield''] [[__-I__ ''headerfield''] [[__-u__ ''headerfield''] [[__-U__ ''headerfield''] [[__-R__ ''oldfield newfield''] [[__-n__ [[''maxprocs'' ]] [[__-m__ ''minfields''] [[__-s__ [[''command'' [[''arg'' ...]]]__
5 __formail -v__
1 perry 6 !!DESCRIPTION
2 PerryLorier 7 __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.
1 perry 8
2 PerryLorier 9 If formail is supposed to determine the sender of the mail, but is unable to find any, it will substitute `foo@bar'.
1 perry 10
2 PerryLorier 11 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 '>'
1 perry 12 !!OPTIONS
2 PerryLorier 13 ;__-v__: Formail will print its version number and exit.
14 ;__-b__: Don't escape any bogus mailbox headers (i.e., lines starting with `From ').
15 ;__-p__ ''prefix'': Define a different quotation prefix. If unspecified it defaults to `
16 ;__-Y__: Assume traditional Berkeley mailbox format, ignoring any __Content-Length:__ fields.
17 ;__-c__: Concatenate continued fields in the header. Might be convenient when postprocessing mail with standard (line oriented) text utilities.
18 ;__-z__: Ensure a whitespace exists between field name and content. Zap fields which contain only a single whitespace character. Zap leading and trailing whitespace on fields extracted with __-x__.
19 ;__-f__: Force formail to simply pass along any non-mailbox format (i.e., don't generate a `From ' line as the first line).
20 ;__-r__: Generate an auto-reply header. This will normally throw away all the existing fields (except X-Loop:) in the original message, fields you wish to preserve need to be named using the __-i__ option. If you use this option in conjunction with __-k__, you can prevent the body from being
1 perry 21 `escaped' by also specifying __-b__.
2 PerryLorier 22 ;__-k__: When generating the auto-reply header or when extracting fields, keep the body as well.
23 ;__-t__: Trust the sender to have used a valid return address in his header. This causes formail to select the ''header sender'' instead of the ''envelope sender'' for the reply. This option should be used when generating auto-reply headers from news articles or when the sender of the message is expecting a reply.
24 ;__-s__: The input will be split up into separate mail messages, and piped into a program one by one (a new program is started for every part). __-s__ has to be the last option specified, the first argument following it is expected to be the name of a program, any other arguments will be passed along to it. If you omit the program, then formail will simply concatenate the split mails on stdout again. See __FILENO__.
25 ;__-n__ ''[[maxprocs]'': Tell formail not to wait for every program to finish before starting the next (causes splits to be processed in parallel). ''Maxprocs'' optionally specifies an upper limit on the number of concurrently running processes.
26 ;__-e__: Do not require empty lines to be preceding the header of a new message (i.e., the messages could start on every line).
27 ;__-d__: Tell formail that the messages it is supposed to split need not be in strict mailbox format (i.e., allows you to split digests/articles or non-standard mailbox formats). This disables recognition of the __Content-Length:__ field.
28 ;__-l folder__: Generate a log summary in the same style as procmail. This includes the entire
29 ;__-B__: Makes formail assume that it is splitting up a BABYL rmail file.
30 ;__-m__ ''minfields'': Allows you to specify the number of consecutive headerfields formail needs to find before it decides it found the start of a new message, it defaults to 2.
31 ;__-q__: Tells formail to (still detect but) be quiet about write errors, duplicate messages and mismatched __Content-Length:__ fields. This option is on by default,
1 perry 32 to make it display the messages use __-q-__.
2 PerryLorier 33 ;__-D__ ''maxlen idcache'': Formail will detect if the Message-ID of the current message has already been seen using an ''idcache'' file of approximately ''maxlen'' size. If not splitting, it will return success if a duplicate has been found. If splitting, it will not output duplicate messages. If used in conjunction with __-r__, formail will look at the ''mail address'' of the envelope sender ''instead'' at the Message-ID.
34 ;__-x__ ''headerfield'': Extract the contents of this ''headerfield'' from the header. Line continuations will be left intact; if you want the value on a single line then you'll also need the __-c__ option.
35 ;__-X__ ''headerfield'': Same as __-x__, but also preserves/includes the field name.
36 ;__-a__ ''headerfield'': Append a custom ''headerfield'' onto the header; but only if a similar field does not exist yet. If you specify either one of the field names __Message-ID:__ or __Resent-Message-ID:__ with no field contents, then formail will generate a unique message-ID for you.
37 ;__-A__ ''headerfield'': Append a custom ''headerfield'' onto the header in any case.
38 ;__-i__ ''headerfield'': Same as __-A__, except that any existing similar fields are renamed by prepending an ``Old-'' prefix. If ''headerfield'' consists only of a field-name, it will not be appended.
39 ;__-I__ ''headerfield'': Same as __-i__, except that any existing similar fields are simply removed. If ''headerfield'' consists only of a field-name, it effectively deletes the field.
40 ;__-u__ ''headerfield'': Make the first occurrence of this field unique, and thus delete all subsequent occurrences of it.
41 ;__-U__ ''headerfield'': Make the last occurrence of this field unique, and thus delete all preceding occurrences of it.
42 ;__-R__ ''oldfield newfield'': Renames all occurrences of the fieldname ''oldfield'' into ''newfield''.
43 ;__+__''skip'': Skip the first ''skip'' messages while splitting.
44 ;__-__''total'': Output at most ''total'' messages while splitting.
1 perry 45
46 !!NOTES
2 PerryLorier 47 When renaming, removing, or extracting fields, partial fieldnames may be used to specify all fields that start with the specified value.
1 perry 48
2 PerryLorier 49 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.
1 perry 50
2 PerryLorier 51 RFC:822, the original standard governing the format of Internet mail messages, did not specify whether Resent header fields (those that begin with `Resent-', such as
3 PerryLorier 52 `Resent-From:') should be considered when generating a reply. Since then, the recommended usage of the Resent headers has evolved to consider them as purely informational and not for use when generating a reply. This has been codified in RFC:2822, the new Internet Message Format
1 perry 53 standard, which states in part:
54
55
2 PerryLorier 56 ;:Resent fields are used to identify a message as having been reintroduced into the transport system by a user. The purpose of using resent fields is to have the message appear to the final recipient as if it were sent directly by the original sender, with all of the original fields remaining the same....They MUST NOT be used in the normal processing of replies or other such automatic actions on messages.
1 perry 57
2 PerryLorier 58 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.
1 perry 59
60 !!ENVIRONMENT
2 PerryLorier 61 ;__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
62 contain a number, FILENO generation is disabled.
1 perry 63
64 !!EXAMPLES
65 To split up a digest one usually uses:
66 formail +1 -ds
67 or
68 formail +1 -ds procmail
69 To remove all Received: fields from the header:
70 formail -I Received:
71 To remove all fields except From: and Subject: from the header:
72 formail -k -X From: -X Subject:
73 To supersede the Reply-To: field in a header you could use:
74 formail -i
75 To convert a non-standard mailbox file into a standard mailbox file you can use:
76 formail -ds
77 Or, if you have a very tolerant mailer:
78 formail -a Date: -ds
79 To extract the header from a message:
80 formail -X
81 or
82 sed -e '/^$/ q'
83 To extract the body from a message:
84 formail -I
85 or
2 PerryLorier 86 sed -e '1,/^$/ d'
1 perry 87
88 !!SEE ALSO
2 PerryLorier 89 mail(1), binmail(1), sendmail(8), procmail(1), sed(1), sh(1), RFC:822, RFC:2822, RFC:1123
1 perry 90 !!DIAGNOSTICS
2 PerryLorier 91 ;Can't fork: Too many processes on this machine.
1 perry 92
2 PerryLorier 93 ;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.
1 perry 94
2 PerryLorier 95 ;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 diag- nostic can be suppressed by the __-q__ option.
1 perry 96
2 PerryLorier 97 ;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.
1 perry 98
2 PerryLorier 99 ;Failed to execute: Program not in path, or not executable.
1 perry 100
2 PerryLorier 101 ;File table full: Too many open files on this machine.
1 perry 102
2 PerryLorier 103 ;Invalid field-name: The specified field-name "x" contains control characters, or cannot be a partial field-name for this option.
1 perry 104
105 !!WARNINGS
2 PerryLorier 106 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 in- coming 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.
1 perry 107
2 PerryLorier 108 In the tradition of UN*X utilities, formail will do exactly what you ask it to, even if it results in a non-__RFC822__ compliant message. In particular, formail
109 will let you generate header fields whose name ends in a space instead of a colon. While this is correct for the leading `From ' line, that line is not a header field so much as the mes- sage separator for the mbox mailbox format. Multiple oc- currences of such a line or any other colonless header field will be considered by many mail programs, including formail itself, as the beginning of a new message. Others will consider the message to be corrupt. Because of
110 this, you should not use the __-i__ option with the `From ' line as the resulting renamed line, `Old-From ', will probably not do what you want it to. If you want to save the original `From ' line, rename it with the __-R__ option to a legal header field such as `X-From_:'.
1 perry 111
112 !!BUGS
2 PerryLorier 113 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.
1 perry 114
2 PerryLorier 115 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 '__.
1 perry 116
2 PerryLorier 117 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 closes its output or terminates it- self.
1 perry 118
2 PerryLorier 119 If formail is instructed to generate an autoreply mail, it will __never__ put more than one address in the `To:' field.
1 perry 120
121 !!MISCELLANEOUS
122 Formail is eight-bit clean.
123
2 PerryLorier 124 When formail has to determine the sender's address, every RFC:822 conforming mail address is allowed. Formail will always strip down the address to its minimal form
125 (deleting excessive comments and whitespace).
1 perry 126
2 PerryLorier 127 The regular expression that is used to find `real' postmarks is:
128 "\n\nFrom [[\t ]*[[^\t\n ]+[[\t ]+[[^\n\t ]"
1 perry 129
130 If a __Content-Length:__ field is found in a header, formail will copy the number of specified bytes in the body verba- tim before resuming the regular scanning for message boundaries (except when splitting digests or Berkeley mailbox format is assumed).
131
2 PerryLorier 132 Any header lines immediately following the leading `From ' line that start with `>From ' are considered to be a continuation of the `From ' line. If instructed to rename the `From ' line, formail will change each leading `>' into a space, thereby transforming those lines into normal RFC:822 Continuations.
1 perry 133
134 !!NOTES
2 PerryLorier 135 Calling up formail with the -h or -? options will cause it to display a command-line help page.
1 perry 136
137 !!SOURCE
2 PerryLorier 138 This program is part of the ''procmail mail-processing-pack- age'' (v3.22) available at http://www.procmail.org/ or ftp.procmail.org in __pub/procmail/__.
1 perry 139
140 !!MAILINGLIST
2 PerryLorier 141 There exists a mailinglist for questions relating to any program in the procmail package:
1 perry 142
2 PerryLorier 143 <procmail-users@procmail.org> for submitting questions/answers.
144 <procmail-users-request@procmail.org> for subscription requests.
1 perry 145
2 PerryLorier 146 If you would like to stay informed about new versions and official patches send a subscription request to
1 perry 147 procmail-announce-request@procmail.org
148 (this is a readonly list).
149 !!AUTHORS
2 PerryLorier 150 Stephen R. van den Berg and Philip A. Guenther
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.

PHP Warning

lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 24 times)