<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <HTML ><HEAD ><link rel='stylesheet' type='text/css' href='manpage.css'> <!-- $Id: reformail.sgml,v 1.1 2001/12/22 21:03:54 mrsam Exp $ --> <!-- Copyright 1998 - 2001 Double Precision, Inc. See COPYING for --> <!-- distribution information. --> <meta name="MSSmartTagsPreventParsing" content="TRUE"> <link rel="icon" href="icon.gif" type="image/gif" /> <TITLE >reformail</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"></HEAD ><BODY CLASS="REFENTRY" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><H1 ><A NAME="REFORMAIL" ></A >reformail</H1 ><DIV CLASS="REFNAMEDIV" ><A NAME="AEN10" ></A ><H2 >Name</H2 >reformail -- E-mail reformatting tool</DIV ><DIV CLASS="REFSYNOPSISDIV" ><A NAME="AEN13" ></A ><H2 >Synopsis</H2 ><P ><B CLASS="COMMAND" >reformail</B > {-D} {len} {<VAR CLASS="REPLACEABLE" >filename</VAR >}</P ><P ><B CLASS="COMMAND" >reformail</B > {-x <VAR CLASS="REPLACEABLE" >header:</VAR >...}</P ><P ><B CLASS="COMMAND" >reformail</B > {-X <VAR CLASS="REPLACEABLE" >header:</VAR >...}</P ><P ><B CLASS="COMMAND" >reformail</B > [<VAR CLASS="REPLACEABLE" >options</VAR >...]</P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN32" ></A ><H2 >DESCRIPTION</H2 ><P >The <B CLASS="COMMAND" >reformail</B > program reads a message on standard input, reformats it in some way, and writes the message to standard output:</P ><DIV CLASS="REFSECT2" ><A NAME="AEN36" ></A ><H3 >Splitting mailboxes into individual messages</H3 ><P >The <VAR CLASS="OPTION" >-s</VAR > 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.</P ><P >If the <VAR CLASS="ENVAR" >FILENO</VAR > environment variable is set to a number, <B CLASS="COMMAND" >reformail</B > will consecutively increment <VAR CLASS="ENVAR" >FILENO</VAR > each time the program is executed for each individual message.</P ><P >If <VAR CLASS="ENVAR" >FILENO</VAR > is not set, it's initial value will be "000". If <VAR CLASS="ENVAR" >FILENO</VAR > is set to a non-numeric value, <VAR CLASS="ENVAR" >FILENO</VAR > will remain unchanged.</P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="AEN48" ></A ><H3 >Detecting duplicate messages</H3 ><P >The <VAR CLASS="OPTION" >-D</VAR > option implements a simple way to delete duplicate messages in incoming mail. <VAR CLASS="REPLACEABLE" >filename</VAR > is a file that will be approximately '<VAR CLASS="REPLACEABLE" >len</VAR >' bytes long. This file will be used by <B CLASS="COMMAND" >reformail</B > to save message IDs seen in recent mail. <B CLASS="COMMAND" >reformail</B > reads the message on standard input. If the message has a <TT CLASS="LITERAL" >Message-ID:</TT > header that's already in the cache file, <B CLASS="COMMAND" >reformail</B > terminates with the exit code set to 0. Otherwise, <B CLASS="COMMAND" >reformail</B > terminates with the exit code set to 1.</P ></DIV ><DIV CLASS="REFSECT2" ><A NAME="AEN59" ></A ><H3 >Extracting headers</H3 ><P >The <VAR CLASS="OPTION" >-x</VAR > and <VAR CLASS="OPTION" >-X</VAR > options extract the indicated headers from the message, and print them to standard output. Multiple <VAR CLASS="OPTION" >-x</VAR > and <VAR CLASS="OPTION" >-X</VAR > options can be specified at the same time, and may be intermixed.</P ><P >The <VAR CLASS="OPTION" >-x</VAR > option extracts and prints the contents of the header. The <VAR CLASS="OPTION" >-X</VAR > option prints the name of the header as well.</P ><P >In all other situations, <B CLASS="COMMAND" >reformail</B > copies the message on its standard input to its standard output, reformatting the message as follows:</P ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN71" ></A ><H2 >OPTIONS</H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >-a'header: value'</DT ><DD ><P >Append a custom header to the message if this header does not already exist. If the header is either <TT CLASS="LITERAL" >Message-ID:</TT > or <TT CLASS="LITERAL" >Resent-Message-ID:</TT > and the value is empty, <B CLASS="COMMAND" >reformail</B > generates a (hopefully) unique message ID for you.</P ></DD ><DT >-A'header: value'</DT ><DD ><P >Append a custom header to the message even if this header already exists. If the header is either <TT CLASS="LITERAL" >Message-ID:</TT > or <TT CLASS="LITERAL" >Resent-Message-ID:</TT > and the value is empty, <B CLASS="COMMAND" >reformail</B > generates a (hopefully) unique message ID for you.</P ></DD ><DT >-c</DT ><DD ><P >Concatenate multi-line headers. Headers split on multiple lines are combined into a single line.</P ></DD ><DT >-d<VAR CLASS="REPLACEABLE" >n</VAR ></DT ><DD ><P >If n is <TT CLASS="LITERAL" >1</TT >, each line will be terminated with CRLF. If n is <TT CLASS="LITERAL" >0</TT > (default), each line will be terminated with LF. <B CLASS="COMMAND" >reformail</B > reads a message with either line terminator, and will force the message to have the specified line termination.</P ></DD ><DT >-f0</DT ><DD ><P >Remove the "<TT CLASS="LITERAL" >From_</TT >" line from the message, if it's there.</P ></DD ><DT >-f1</DT ><DD ><P >Add the "<TT CLASS="LITERAL" >From_</TT >" line to the message, if it's not there. <B CLASS="COMMAND" >reformail</B > will attempt to generate the "<TT CLASS="LITERAL" >From_</TT >" line from any <TT CLASS="LITERAL" >Errors-To:</TT >, <TT CLASS="LITERAL" >Return-Path:</TT >, or <TT CLASS="LITERAL" >From:</TT > headers in the message. "<TT CLASS="LITERAL" >root</TT >" will be used if <B CLASS="COMMAND" >reformail</B > is unable to determine the return address.</P ></DD ><DT >-i'<VAR CLASS="REPLACEABLE" >header: value</VAR >'</DT ><DD ><P >Appends a custom header to the message. If this header already exists it is renamed by prepending "<TT CLASS="LITERAL" >Old-</TT >" to the name of the header.</P ></DD ><DT >-I'<VAR CLASS="REPLACEABLE" >header: value</VAR >'</DT ><DD ><P >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.</P ></DD ><DT >-k</DT ><DD ><P >After generating an auto-reply header using the <VAR CLASS="OPTION" >-r</VAR > option, keep the contents of the message itself in the auto-reply.</P ></DD ><DT >-p'prefix'</DT ><DD ><P >When both <VAR CLASS="OPTION" >-r</VAR > and <VAR CLASS="OPTION" >-k</VAR > options are used, the <VAR CLASS="OPTION" >-p</VAR > option can be used to change the quoting prefix for each line from its default value of "<TT CLASS="LITERAL" >> </TT >".</P ></DD ><DT >-P'salutation'</DT ><DD ><P >When both <VAR CLASS="OPTION" >-r</VAR > and <VAR CLASS="OPTION" >-k</VAR > options are used, the <VAR CLASS="OPTION" >-p</VAR > option is used to specify the salutation that begins the contents of the message. See <A HREF="#autoreplies" TARGET="_top" >AUTOREPLIES</A > below.</P ></DD ><DT >-r</DT ><DD ><P >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 created both the <TT CLASS="LITERAL" >In-Reply-To:</TT > and <TT CLASS="LITERAL" >References:</TT > headers). When generating replies to Usenet messages, you'll probably have to always use the <VAR CLASS="OPTION" >-t</VAR > option also.</P ></DD ><DT >-t</DT ><DD ><P >Use user-generated headers in order to determine the return address for the <VAR CLASS="OPTION" >-r</VAR > option. Otherwise, <B CLASS="COMMAND" >reformail</B > uses machine generated headers.</P ></DD ><DT >-R oldheader: newheader:</DT ><DD ><P >Rename the indicated header.</P ></DD ><DT >-u'header:'</DT ><DD ><P >If this header occurs multiple times in the message, remove all occurrences except the first one.</P ></DD ><DT >-U'header:'</DT ><DD ><P >If this header occurs multiple times in the message, remove all occurrences except the last one.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN174" ></A ><H2 >AUTOREPLIES</H2 ><A NAME="AUTOREPLIES" ></A ><P >The <VAR CLASS="OPTION" >-r</VAR > 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 <VAR CLASS="OPTION" >-r</VAR > option is smart enough to be able to properly generate an auto-reply to either an E-mail message, or a Usenet message ( <B CLASS="COMMAND" >reformail</B > creates both a <TT CLASS="LITERAL" >In-Reply-To:</TT > and <TT CLASS="LITERAL" >References:</TT > header).</P ><P >The <TT CLASS="LITERAL" >To:</TT > header is set to the apparent sender of the message. To determine the sender of the message, <B CLASS="COMMAND" >reformail</B > prefers to look at machine-generated headers, such a <TT CLASS="LITERAL" >Errors-To:</TT >and <TT CLASS="LITERAL" >Return-Path:</TT >, instead of user-generated headers, such as <TT CLASS="LITERAL" >From:</TT > or <TT CLASS="LITERAL" >Reply-To:</TT >.</P ><P >The <VAR CLASS="OPTION" >-t</VAR > option makes <B CLASS="COMMAND" >reformail</B > use user-generated headers instead of machine-generated headers.</P ><P >The <VAR CLASS="OPTION" >-ra</VAR > option copies <TT CLASS="LITERAL" >To:</TT > headers from the original message into the auto-reply. The <VAR CLASS="OPTION" >-rA</VAR > option copies <TT CLASS="LITERAL" >To:</TT > and <TT CLASS="LITERAL" >Cc:</TT > headers.</P ><P >Normally, the contents of the original message are removed. The <VAR CLASS="OPTION" >-k</VAR > option copies the contents of the original message, which each line prefixed by "<TT CLASS="LITERAL" >> </TT >". Use the <VAR CLASS="OPTION" >-p</VAR > option to specify a different prefix.</P ><P >The contents of the message are preceded by a salutation specified by the <VAR CLASS="OPTION" >-P</VAR > option. If not specified, the salutation defaults to "<TT CLASS="LITERAL" >%F writes:%n</TT >". Within the salutation, each occurrence of <SPAN CLASS="TOKEN" >%</SPAN > followed by another character is replaced by some information from the original message, as follows:</P ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT >%C</DT ><DD ><P >Replaced by the contents of the <TT CLASS="LITERAL" >X-Newsgroup:</TT > header in the original message.</P ></DD ><DT >%d</DT ><DD ><P >Replaced by the contents of the <TT CLASS="LITERAL" >Date:</TT > header in the original message.</P ></DD ><DT >%f</DT ><DD ><P >Replaced by the E-mail address of the sender of the original message.</P ></DD ><DT >%F</DT ><DD ><P >Replaced by the name of the sender of the original message. If no name was given, the E-mail address is used.</P ></DD ><DT >%i</DT ><DD ><P >Replaced by the contents of the <TT CLASS="LITERAL" >Message-ID:</TT > header in the original message.</P ></DD ><DT >%n</DT ><DD ><P >%n will cause <B CLASS="COMMAND" >reformail</B > to insert a line break here.</P ></DD ><DT >%N</DT ><DD ><P >Replaced by the contents of the <TT CLASS="LITERAL" >Newsgroups:</TT > header in the original message.</P ></DD ><DT >%s</DT ><DD ><P >Replaced by the contents of any <TT CLASS="LITERAL" >Subject:</TT > header in the original message.</P ></DD ></DL ></DIV ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN246" ></A ><H2 >BUGS</H2 ><P >For the <VAR CLASS="OPTION" >-a</VAR >, <VAR CLASS="OPTION" >-A</VAR >, and <VAR CLASS="OPTION" >-I</VAR > options, a space after the header name and the colon is considered to be a non-empty field.</P ><P >Do not provide the same header to more than one family of header-modifying options, such as <VAR CLASS="OPTION" >-u</VAR >/<VAR CLASS="OPTION" >-U</VAR > and <VAR CLASS="OPTION" >-a</VAR >/<VAR CLASS="OPTION" >-A</VAR >. Doing so yields unpredictable results. It's better to run <VAR CLASS="OPTION" >reformail</VAR > several times (use a pipe, perhaps).</P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN258" ></A ><H2 >SEE ALSO</H2 ><P ><A HREF="courier.html" TARGET="_top" ><SPAN CLASS="CITEREFENTRY" ><SPAN CLASS="REFENTRYTITLE" >courier</SPAN >(8)</SPAN ></A >, <SPAN CLASS="CITEREFENTRY" ><SPAN CLASS="REFENTRYTITLE" >sendmail</SPAN >(8)</SPAN >, <A HREF="mailbot.html" TARGET="_top" ><SPAN CLASS="CITEREFENTRY" ><SPAN CLASS="REFENTRYTITLE" >mailbot</SPAN >(1)</SPAN ></A >, <A HREF="maildrop.html" TARGET="_top" ><SPAN CLASS="CITEREFENTRY" ><SPAN CLASS="REFENTRYTITLE" >maildrop</SPAN >(1)</SPAN ></A >.</P ></DIV ></BODY ></HTML >