| 1 |
'\" t |
| 2 |
.\"<!-- Copyright 1998 - 2007 Double Precision, Inc. See COPYING for --> |
| 3 |
.\"<!-- distribution information. --> |
| 4 |
.\" Title: reformail |
| 5 |
.\" Author: Sam Varshavchik |
| 6 |
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> |
| 7 |
.\" Date: 11/04/2020 |
| 8 |
.\" Manual: Double Precision, Inc. |
| 9 |
.\" Source: Courier Mail Server |
| 10 |
.\" Language: English |
| 11 |
.\" |
| 12 |
.TH "REFORMAIL" "1" "11/04/2020" "Courier Mail Server" "Double Precision, Inc\&." |
| 13 |
.\" ----------------------------------------------------------------- |
| 14 |
.\" * Define some portability stuff |
| 15 |
.\" ----------------------------------------------------------------- |
| 16 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 17 |
.\" http://bugs.debian.org/507673 |
| 18 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 19 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 20 |
.ie \n(.g .ds Aq \(aq |
| 21 |
.el .ds Aq ' |
| 22 |
.\" ----------------------------------------------------------------- |
| 23 |
.\" * set default formatting |
| 24 |
.\" ----------------------------------------------------------------- |
| 25 |
.\" disable hyphenation |
| 26 |
.nh |
| 27 |
.\" disable justification (adjust text to left margin only) |
| 28 |
.ad l |
| 29 |
.\" ----------------------------------------------------------------- |
| 30 |
.\" * MAIN CONTENT STARTS HERE * |
| 31 |
.\" ----------------------------------------------------------------- |
| 32 |
.SH "NAME" |
| 33 |
reformail \- E\-mail reformatting tool |
| 34 |
.SH "SYNOPSIS" |
| 35 |
.HP \w'\fBreformail\fR\ 'u |
| 36 |
\fBreformail\fR \-s command [option...] |
| 37 |
.HP \w'\fBreformail\fR\ 'u |
| 38 |
\fBreformail\fR \-D len \fIfilename\fR |
| 39 |
.HP \w'\fBreformail\fR\ 'u |
| 40 |
\fBreformail\fR \-x\ \fIheader:\fR... |
| 41 |
.HP \w'\fBreformail\fR\ 'u |
| 42 |
\fBreformail\fR \-X\ \fIheader:\fR... |
| 43 |
.HP \w'\fBreformail\fR\ 'u |
| 44 |
\fBreformail\fR [\fIoptions\fR...] |
| 45 |
.sp |
| 46 |
See below for additional options |
| 47 |
.SH "DESCRIPTION" |
| 48 |
.PP |
| 49 |
The |
| 50 |
\fBreformail\fR |
| 51 |
program reads a message on standard input, reformats it in some way, and writes the message to standard output: |
| 52 |
.SS "Splitting mailboxes into individual messages" |
| 53 |
.PP |
| 54 |
The |
| 55 |
\fB\-s\fR |
| 56 |
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\&. |
| 57 |
.PP |
| 58 |
If the |
| 59 |
\fBFILENO\fR |
| 60 |
environment variable is set to a number, |
| 61 |
\fBreformail\fR |
| 62 |
will consecutively increment |
| 63 |
\fBFILENO\fR |
| 64 |
each time the program is executed for each individual message\&. |
| 65 |
.PP |
| 66 |
If |
| 67 |
\fBFILENO\fR |
| 68 |
is not set, it\*(Aqs initial value will be "000"\&. If |
| 69 |
\fBFILENO\fR |
| 70 |
is set to a non\-numeric value, |
| 71 |
\fBFILENO\fR |
| 72 |
will remain unchanged\&. |
| 73 |
.SS "Detecting duplicate messages" |
| 74 |
.PP |
| 75 |
The |
| 76 |
\fB\-D\fR |
| 77 |
option implements a simple way to delete duplicate messages in incoming mail\&. |
| 78 |
\fIfilename\fR |
| 79 |
is a file that will be approximately \*(Aq\fIlen\fR\*(Aq bytes long\&. This file will be used by |
| 80 |
\fBreformail\fR |
| 81 |
to save message IDs seen in recent mail\&. |
| 82 |
\fBreformail\fR |
| 83 |
reads the message on standard input\&. If the message has a |
| 84 |
Message\-ID: |
| 85 |
header that\*(Aqs already in the cache file, |
| 86 |
\fBreformail\fR |
| 87 |
terminates with the exit code set to 0\&. Otherwise, |
| 88 |
\fBreformail\fR |
| 89 |
terminates with the exit code set to 1\&. |
| 90 |
.if n \{\ |
| 91 |
.sp |
| 92 |
.\} |
| 93 |
.RS 4 |
| 94 |
.nr an-no-space-flag 1 |
| 95 |
.nr an-break-flag 1 |
| 96 |
.br |
| 97 |
.ps +1 |
| 98 |
\fBNote\fR |
| 99 |
.ps -1 |
| 100 |
.br |
| 101 |
.PP |
| 102 |
Unlike a similar feature in the |
| 103 |
\fBformail\fR |
| 104 |
command, |
| 105 |
\fBreformail\fR |
| 106 |
takes care of locking the file, so it\*(Aqs not necessary to implement your own locking mechanism for this option\&. |
| 107 |
.sp .5v |
| 108 |
.RE |
| 109 |
.SS "Extracting headers" |
| 110 |
.PP |
| 111 |
The |
| 112 |
\fB\-x\fR |
| 113 |
and |
| 114 |
\fB\-X\fR |
| 115 |
options extract the indicated headers from the message, and print them to standard output\&. Multiple |
| 116 |
\fB\-x\fR |
| 117 |
and |
| 118 |
\fB\-X\fR |
| 119 |
options can be specified at the same time, and may be intermixed\&. |
| 120 |
.PP |
| 121 |
The |
| 122 |
\fB\-x\fR |
| 123 |
option extracts and prints the contents of the header\&. The |
| 124 |
\fB\-X\fR |
| 125 |
option prints the name of the header as well\&. |
| 126 |
.PP |
| 127 |
In all other situations, |
| 128 |
\fBreformail\fR |
| 129 |
copies the message on its standard input to its standard output, reformatting the message as follows: |
| 130 |
.SH "OPTIONS" |
| 131 |
.PP |
| 132 |
\-a\*(Aqheader: value\*(Aq |
| 133 |
.RS 4 |
| 134 |
Append a custom header to the message if this header does not already exist\&. If the header is either |
| 135 |
Message\-ID: |
| 136 |
or |
| 137 |
Resent\-Message\-ID: |
| 138 |
and the value is empty, |
| 139 |
\fBreformail\fR |
| 140 |
generates a (hopefully) unique message ID for you\&. |
| 141 |
.RE |
| 142 |
.PP |
| 143 |
\-A\*(Aqheader: value\*(Aq |
| 144 |
.RS 4 |
| 145 |
Append a custom header to the message even if this header already exists\&. If the header is either |
| 146 |
Message\-ID: |
| 147 |
or |
| 148 |
Resent\-Message\-ID: |
| 149 |
and the value is empty, |
| 150 |
\fBreformail\fR |
| 151 |
generates a (hopefully) unique message ID for you\&. |
| 152 |
.RE |
| 153 |
.PP |
| 154 |
\-c |
| 155 |
.RS 4 |
| 156 |
Concatenate multi\-line headers\&. Headers split on multiple lines are combined into a single line\&. |
| 157 |
.RE |
| 158 |
.PP |
| 159 |
\-d\fIn\fR |
| 160 |
.RS 4 |
| 161 |
If n is |
| 162 |
1, each line will be terminated with CRLF\&. If n is |
| 163 |
0 |
| 164 |
(default), each line will be terminated with LF\&. |
| 165 |
\fBreformail\fR |
| 166 |
reads a message with either line terminator, and will force the message to have the specified line termination\&. |
| 167 |
.RE |
| 168 |
.PP |
| 169 |
\-f0 |
| 170 |
.RS 4 |
| 171 |
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\&. |
| 172 |
.RE |
| 173 |
.PP |
| 174 |
\-f1 |
| 175 |
.RS 4 |
| 176 |
Add the "From_" line to the message, if it\*(Aqs not there\&. |
| 177 |
\fBreformail\fR |
| 178 |
will attempt to generate the "From_" line from any |
| 179 |
Errors\-To:, |
| 180 |
Return\-Path:, or |
| 181 |
From: |
| 182 |
headers in the message\&. "root" will be used if |
| 183 |
\fBreformail\fR |
| 184 |
is unable to determine the return address\&. |
| 185 |
.RE |
| 186 |
.PP |
| 187 |
\-i\*(Aq\fIheader: value\fR\*(Aq |
| 188 |
.RS 4 |
| 189 |
Appends a custom header to the message\&. If this header already exists it is renamed by prepending "Old\-" to the name of the header\&. |
| 190 |
.RE |
| 191 |
.PP |
| 192 |
\-I\*(Aq\fIheader: value\fR\*(Aq |
| 193 |
.RS 4 |
| 194 |
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\&. |
| 195 |
.RE |
| 196 |
.PP |
| 197 |
\-R oldheader: newheader: |
| 198 |
.RS 4 |
| 199 |
Rename the indicated header\&. |
| 200 |
.RE |
| 201 |
.PP |
| 202 |
\-u\*(Aqheader:\*(Aq |
| 203 |
.RS 4 |
| 204 |
If this header occurs multiple times in the message, remove all occurrences except the first one\&. |
| 205 |
.RE |
| 206 |
.PP |
| 207 |
\-U\*(Aqheader:\*(Aq |
| 208 |
.RS 4 |
| 209 |
If this header occurs multiple times in the message, remove all occurrences except the last one\&. |
| 210 |
.RE |
| 211 |
.SH "AUTOREPLIES" |
| 212 |
.PP |
| 213 |
The autoreply options from earlier versions of |
| 214 |
\fBmailbot\fR |
| 215 |
have been moved into |
| 216 |
\m[blue]\fB\fBmailbot\fR(1)\fR\m[]\&\s-2\u[1]\d\s+2\&. |
| 217 |
.SH "BUGS" |
| 218 |
.PP |
| 219 |
For the |
| 220 |
\fB\-a\fR, |
| 221 |
\fB\-A\fR, and |
| 222 |
\fB\-I\fR |
| 223 |
options, a space after the header name and the colon is considered to be a non\-empty field\&. |
| 224 |
.PP |
| 225 |
Do not provide the same header to more than one family of header\-modifying options, such as |
| 226 |
\fB\-u\fR/\fB\-U\fR |
| 227 |
and |
| 228 |
\fB\-a\fR/\fB\-A\fR\&. Doing so yields unpredictable results\&. It\*(Aqs better to run |
| 229 |
\fBreformail\fR |
| 230 |
several times (use a pipe, perhaps)\&. |
| 231 |
.SH "SEE ALSO" |
| 232 |
.PP |
| 233 |
\m[blue]\fB\fBcourier\fR(8)\fR\m[]\&\s-2\u[2]\d\s+2, |
| 234 |
\fBsendmail\fR(8), |
| 235 |
\m[blue]\fB\fBmailbot\fR(1)\fR\m[]\&\s-2\u[1]\d\s+2, |
| 236 |
\m[blue]\fB\fBmaildrop\fR(1)\fR\m[]\&\s-2\u[3]\d\s+2\&. |
| 237 |
.SH "AUTHOR" |
| 238 |
.PP |
| 239 |
\fBSam Varshavchik\fR |
| 240 |
.RS 4 |
| 241 |
Author |
| 242 |
.RE |
| 243 |
.SH "NOTES" |
| 244 |
.IP " 1." 4 |
| 245 |
\fBmailbot\fR(1) |
| 246 |
.RS 4 |
| 247 |
\%http://www.courier-mta.org/maildrop/mailbot.html |
| 248 |
.RE |
| 249 |
.IP " 2." 4 |
| 250 |
\fBcourier\fR(8) |
| 251 |
.RS 4 |
| 252 |
\%http://www.courier-mta.org/maildrop/courier.html |
| 253 |
.RE |
| 254 |
.IP " 3." 4 |
| 255 |
\fBmaildrop\fR(1) |
| 256 |
.RS 4 |
| 257 |
\%http://www.courier-mta.org/maildrop/maildrop.html |
| 258 |
.RE |