File: reformail.html

package info (click to toggle)
maildrop 0.54a-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 872 kB
  • ctags: 883
  • sloc: cpp: 8,469; ansic: 658; sh: 327; makefile: 82
file content (255 lines) | stat: -rw-r--r-- 9,372 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<!-- DSTART                                                                -->
<!--                                                                       -->
<!--           maildrop - mail delivery agent with filtering abilities     -->
<!--                                                                       -->
<!--  Copyright 1998, Double Precision Inc.                                -->
<!--                                                                       -->
<!--  This program is distributed under the terms of the GNU General Publi -->
<!--  License. See COPYING for additional information.                     -->
<!-- DEND                                                                  -->
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; Linux 2.0.34 i586) [Netscape]">
   <TITLE>reformail - reformat mail</TITLE>
<!-- $Id: reformail.html 1.3 1998/08/11 02:10:23 mrsam Exp $ -->
<!-- SECTION 1 -->
</HEAD>
<BODY>

<H1>
reformail - reformat mail</H1>

<BR><BR>
<H2>
SYNOPSIS</H2>
<TT>reformail [-d] -s program arg arg ...</TT>

<P><TT>reformail -D len filename</TT>

<P><TT>reformail -x header: -x header: ...</TT>

<P><TT>reformail -X header: -X header: ...</TT>

<P><TT>reformail [options] ...</TT>
<BR><BR>
<H2>
DESCRIPTION</H2>
The <I>reformail</I> program reads a message on standard input, reformats it
in some way, and writes the message to standard output.
<H3>
Splitting mailboxes into individual messages</H3>
The -s option splits the mbox-formatted mailbox file on standard input
into individual messages. The specified external program is executed for
each message. The contents of each individual message will be provided
to the program on standard input.

<P>If the <TT>FILENO</TT> environment variable is set to a number, <I>reformail</I>
will consecutively increment the <TT>FILENO</TT> environment variable each
time the program is executed for each individual message.

<P>If <TT>FILENO</TT> is not set, it's initial value will be "000". If
<TT>FILENO</TT> is set to a non-numeric value, <TT>FILENO</TT> will remain
unchanged.
<H3>
Detecting duplicate messages</H3>
The -D option implements a simple way to delete duplicate messages in incoming
mail. <I>filename</I> is a file that will be approximately 'len' bytes
long. This file will be used by reformail to contain a list of message
IDs seen in recent mail. <I>reformail</I> reads the message on standard input.
If the message has a <I>Message-ID:</I> header that's already in the cache
file, <I>reformail</I> terminates with the exit code set to 0. Otherwise, <I>reformail</I>
terminates with the exit code set to 1.
<H3>
Extracting headers</H3>
The -x and -X options extract the indicated headers from the message, and
print them to standard output. Multiple -x and -X options can be specified
at the same time, and may be intermixed.

<P>The -x option extracts and prints the contents of the header. The -X
option prints the name of the header as well.

<P>In all other situations, <I>reformail</I> will simply copy the message on
its standard input to the standard output, reformatting the message as
follows:
<BR><BR>
<H2>
OPTIONS</H2>

<UL>
<LI>
-a'header: value' - appends a custom header to the message if this header
does not already exist. If header is either Message-ID: or Resent-Message-ID:
and the value is empty, <I>reformail</I> will generate a (hopefully) unique
message ID for you.</LI>

<BR><TT>&nbsp;</TT>
<LI>
-A'header: value' - appends a custom header to the message even if this
header already exists. If header is either Message-ID: or Resent-Message-ID:
and the value is empty, <I>reformail</I> will generate a (hopefully) unique
message ID for you.</LI>

<BR><TT>&nbsp;</TT>
<LI>
-c - concatenate multi-line headers. Headers split on multiple lines are
concatenated into a single line (each).</LI>

<BR><TT>&nbsp;</TT>
<LI>
-dn - if n is 1, each line will be terminated with CRLF. If n is 0 (default),
each line will be terminated with LF. <I>reformail</I> reads a message with
either line terminator, and will force the message to have the specified
line termination.</LI>

<BR><TT>&nbsp;</TT>
<LI>
-f0 - remove the "From " line from the message, if it's there.</LI>

<BR><TT>&nbsp;</TT>
<LI>
-f1 - add the "From " line to the message, if it's not there. <I>reformail</I>
will attempt to generate the "From " line from any Errors-To:, Return-Path:,
or From: headers in the message. If <I>reformail</I> is unable to determine
the return address, "root" will be used.</LI>

<BR><TT>&nbsp;</TT>
<LI>
-i'header: value' - appends a custom header to the message. If this header
already exists it is renamed by prepending "Old-" to the name of the header.</LI>

<BR><TT>&nbsp;</TT>
<LI>
-I'header: value' - appends a custom header to the message. If this header
already exists in the message, the old header is completely removed. If
the value is empty, any existing header is completely removed, and nothing
gets appended.</LI>

<BR><TT>&nbsp;</TT>
<LI>
-k - after generating an auto-reply header using the -r option, keep the
contents of the message itself in the auto-reply.</LI>

<BR><TT>&nbsp;</TT>
<LI>
-p'prefix' - when both -r and -k options are used, the -p option can be
used to change the quoting prefix for each line from its default value
of "> ".</LI>

<BR><TT>&nbsp;</TT>
<LI>
-P'salutation' - when both -r and -k options are used, the -P option is
used to specify the salutation that begins the contents of the message.
See <A HREF="#autoreplies">AUTOREPLIES</A> below.</LI>

<BR><TT>&nbsp;</TT>
<LI>
-r - generates headers for an auto-reply to this message. This option can
be used to create replies to both E-mail and Usenet messages (reformail
create both In-Reply-To: and References: headers). When generating replies
to Usenet messages, you'll probably have to always use the -t option also.</LI>

<BR><TT>&nbsp;</TT>
<LI>
-t - use user-generated headers in order to determine the return address
for the -r option. Otherwise, <I>reformail</I> will use machine generated headers.</LI>

<BR><TT>&nbsp;</TT>
<LI>
-R oldheader: newheader: - renames the indicated header.</LI>

<BR><TT>&nbsp;</TT>
<LI>
-u'header:' - if this header occurs multiple times in the message, remove
all occurrences except the first one.</LI>

<BR><TT>&nbsp;</TT>
<LI>
-U'header:' - if this header occurs multiple times in the message, remove
all occurrences except the last one.&nbsp;<A NAME="autoreplies"></A></LI>
</UL>

<BR><BR>
<H2>
AUTOREPLIES</H2>
The -r option generates a set of headers for an automatic reply to the
message, instead of producing just a reformatted copy of the message. As
an enhancement, the -r option is smart enough to be able to properly generate
an auto-reply to either an E-mail message, or a Usenet message ( <I>reformail</I>
will generate both an In-Reply-To: and References: header).

<P>The To: header is set to the apparent sender of the message. To determine
the sender of the message, <I>reformail</I> prefers to look at machine-generated
headers, such as Errors-To: and Return-Path:, instead of user-generated
headers, such as From: or Reply-To:.

<P>The -t option makes <I>reformail</I> use user-generated headers instead of
machine-generated headers.

<P>The -ra option copies To: headers from the original message into the
auto-reply. The -rA option copies To: and Cc: headers.

<P>Normally, the contents of the original message are removed. The -k option
copies the contents of the original message, which each line prefixed by
"> ". Use the "-p" option to specify a different prefix.

<P>The contents of the message are preceded by a salutation specified by
the -P option. If not specified, the salutation defaults to "%F writes:%n".
Within the salutation, each occurrence of % followed by another character
is replaced by some information from the original message, as follows:
<UL>
<LI>
<TT>%C</TT> - replaced by the contents of any X-Newsgroup: header in the
original message.</LI>

<BR><TT>&nbsp;</TT>
<LI>
<TT>%d</TT> - replaced by the contents of any Date: header in the original
message.</LI>

<BR><TT>&nbsp;</TT>
<LI>
<TT>%f </TT>- replaced by the E-mail address of the sender of the original
message.</LI>

<BR><TT>&nbsp;</TT>
<LI>
<TT>%F</TT> - replaced by the name of the sender of the original message.
If no name was given, the E-mail address is used.</LI>

<BR><TT>&nbsp;</TT>
<LI>
<TT>%i</TT> - replaced by the contents of any Message-ID: header in the
original message.</LI>

<BR><TT>&nbsp;</TT>
<LI>
<TT>%n</TT> - %n will cause <I>reformail</I> to insert a line break here.</LI>

<BR><TT>&nbsp;</TT>
<LI>
<TT>%N</TT> - replaced by the contents of any Newsgroups: header in the
original message.</LI>

<BR><TT>&nbsp;</TT>
<LI>
<TT>%s </TT>- replaced by the contents of any Subject: header in the original
message.</LI>
</UL>

<BR><BR>
<H2>
BUGS</H2>
For the -a, -A, and -I options, a space after the header name and the colon
is considered to be a non-empty field.

<P>Do not provide the same header to more than one family of header-modifying
options, such as -u/-U and -a/-A. Doing so yields unpredictable results.
If you have a need to do so, run <I>reformail</I> several times (use a pipe,
perhaps).
<BR><BR>
<H2>
SEE ALSO</H2>
sendmail(8), <A HREF="maildrop.html">maildrop(1)</A>
</BODY>
</HTML>