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
256
257
258
259
|
'\" t
.\"<!-- Copyright 1998 - 2007 Double Precision, Inc. See COPYING for -->
.\"<!-- distribution information. -->
.\" Title: reformail
.\" Author: Sam Varshavchik
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 06/20/2015
.\" Manual: Double Precision, Inc.
.\" Source: Courier Mail Server
.\" Language: English
.\"
.TH "REFORMAIL" "1" "06/20/2015" "Courier Mail Server" "Double Precision, Inc\&."
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
reformail \- E\-mail reformatting tool
.SH "SYNOPSIS"
.HP \w'\fBreformail\fR\ 'u
\fBreformail\fR \-s command [option...]
.HP \w'\fBreformail\fR\ 'u
\fBreformail\fR \-D len \fIfilename\fR
.HP \w'\fBreformail\fR\ 'u
\fBreformail\fR \-x\ \fIheader:\fR...
.HP \w'\fBreformail\fR\ 'u
\fBreformail\fR \-X\ \fIheader:\fR...
.HP \w'\fBreformail\fR\ 'u
\fBreformail\fR [\fIoptions\fR...]
.sp
See below for additional options
.SH "DESCRIPTION"
.PP
The
\fBreformail\fR
program reads a message on standard input, reformats it in some way, and writes the message to standard output:
.SS "Splitting mailboxes into individual messages"
.PP
The
\fB\-s\fR
option splits the mbox\-formatted mailbox file on standard input into individual messages\&. An external program is executed for each message\&. The contents of each individual message will be provided to the external program on standard input\&.
.PP
If the
\fBFILENO\fR
environment variable is set to a number,
\fBreformail\fR
will consecutively increment
\fBFILENO\fR
each time the program is executed for each individual message\&.
.PP
If
\fBFILENO\fR
is not set, it\*(Aqs initial value will be "000"\&. If
\fBFILENO\fR
is set to a non\-numeric value,
\fBFILENO\fR
will remain unchanged\&.
.SS "Detecting duplicate messages"
.PP
The
\fB\-D\fR
option implements a simple way to delete duplicate messages in incoming mail\&.
\fIfilename\fR
is a file that will be approximately \*(Aq\fIlen\fR\*(Aq bytes long\&. This file will be used by
\fBreformail\fR
to save message IDs seen in recent mail\&.
\fBreformail\fR
reads the message on standard input\&. If the message has a
Message\-ID:
header that\*(Aqs already in the cache file,
\fBreformail\fR
terminates with the exit code set to 0\&. Otherwise,
\fBreformail\fR
terminates with the exit code set to 1\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
Unlike a similar feature in the
\fBformail\fR
command,
\fBreformail\fR
takes care of locking the file, so it\*(Aqs not necessary to implement your own locking mechanism for this option\&.
.sp .5v
.RE
.SS "Extracting headers"
.PP
The
\fB\-x\fR
and
\fB\-X\fR
options extract the indicated headers from the message, and print them to standard output\&. Multiple
\fB\-x\fR
and
\fB\-X\fR
options can be specified at the same time, and may be intermixed\&.
.PP
The
\fB\-x\fR
option extracts and prints the contents of the header\&. The
\fB\-X\fR
option prints the name of the header as well\&.
.PP
In all other situations,
\fBreformail\fR
copies the message on its standard input to its standard output, reformatting the message as follows:
.SH "OPTIONS"
.PP
\-a\*(Aqheader: value\*(Aq
.RS 4
Append a custom header to the message if this header does not already exist\&. If the header is either
Message\-ID:
or
Resent\-Message\-ID:
and the value is empty,
\fBreformail\fR
generates a (hopefully) unique message ID for you\&.
.RE
.PP
\-A\*(Aqheader: value\*(Aq
.RS 4
Append a custom header to the message even if this header already exists\&. If the header is either
Message\-ID:
or
Resent\-Message\-ID:
and the value is empty,
\fBreformail\fR
generates a (hopefully) unique message ID for you\&.
.RE
.PP
\-c
.RS 4
Concatenate multi\-line headers\&. Headers split on multiple lines are combined into a single line\&.
.RE
.PP
\-d\fIn\fR
.RS 4
If n is
1, each line will be terminated with CRLF\&. If n is
0
(default), each line will be terminated with LF\&.
\fBreformail\fR
reads a message with either line terminator, and will force the message to have the specified line termination\&.
.RE
.PP
\-f0
.RS 4
Any initial blank lines are removed\&. If the first non\-blank line is a "From_" line, it gets converted to a "Return\-Path:" header, and any existing "Return\-Path:" header gets removed\&. If the message does not start with a "From_" line, the message remains unchanged\&.
.RE
.PP
\-f1
.RS 4
Add the "From_" line to the message, if it\*(Aqs not there\&.
\fBreformail\fR
will attempt to generate the "From_" line from any
Errors\-To:,
Return\-Path:, or
From:
headers in the message\&. "root" will be used if
\fBreformail\fR
is unable to determine the return address\&.
.RE
.PP
\-i\*(Aq\fIheader: value\fR\*(Aq
.RS 4
Appends a custom header to the message\&. If this header already exists it is renamed by prepending "Old\-" to the name of the header\&.
.RE
.PP
\-I\*(Aq\fIheader: value\fR\*(Aq
.RS 4
Append 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\&.
.RE
.PP
\-R oldheader: newheader:
.RS 4
Rename the indicated header\&.
.RE
.PP
\-u\*(Aqheader:\*(Aq
.RS 4
If this header occurs multiple times in the message, remove all occurrences except the first one\&.
.RE
.PP
\-U\*(Aqheader:\*(Aq
.RS 4
If this header occurs multiple times in the message, remove all occurrences except the last one\&.
.RE
.SH "AUTOREPLIES"
.PP
The autoreply options from earlier versions of
\fBmailbot\fR
have been moved into
\m[blue]\fB\fBmailbot\fR(1)\fR\m[]\&\s-2\u[1]\d\s+2\&.
.SH "BUGS"
.PP
For the
\fB\-a\fR,
\fB\-A\fR, and
\fB\-I\fR
options, a space after the header name and the colon is considered to be a non\-empty field\&.
.PP
Do not provide the same header to more than one family of header\-modifying options, such as
\fB\-u\fR/\fB\-U\fR
and
\fB\-a\fR/\fB\-A\fR\&. Doing so yields unpredictable results\&. It\*(Aqs better to run
\fBreformail\fR
several times (use a pipe, perhaps)\&.
.SH "SEE ALSO"
.PP
\m[blue]\fB\fBcourier\fR(8)\fR\m[]\&\s-2\u[2]\d\s+2,
\fBsendmail\fR(8),
\m[blue]\fB\fBmailbot\fR(1)\fR\m[]\&\s-2\u[1]\d\s+2,
\m[blue]\fB\fBmaildrop\fR(1)\fR\m[]\&\s-2\u[3]\d\s+2\&.
.SH "AUTHOR"
.PP
\fBSam Varshavchik\fR
.RS 4
Author
.RE
.SH "NOTES"
.IP " 1." 4
\fBmailbot\fR(1)
.RS 4
\%http://www.courier-mta.org/maildrop/mailbot.html
.RE
.IP " 2." 4
\fBcourier\fR(8)
.RS 4
\%http://www.courier-mta.org/maildrop/courier.html
.RE
.IP " 3." 4
\fBmaildrop\fR(1)
.RS 4
\%http://www.courier-mta.org/maildrop/maildrop.html
.RE
|