reformail - E-mail reformatting tool
reformail -s command [option...] reformail -D len filename reformail -x header:... reformail -X header:... reformail [options...] See below for additional options
The reformail program reads a message on standard input, reformats it in some way, and writes the message to standard output: Splitting mailboxes into individual messages The -s 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. If the FILENO environment variable is set to a number, reformail will consecutively increment FILENO each time the program is executed for each individual message. If FILENO is not set, it's initial value will be "000". If FILENO is set to a non-numeric value, FILENO will remain unchanged. Detecting duplicate messages The -D option implements a simple way to delete duplicate messages in incoming mail. filename is a file that will be approximately 'len' bytes long. This file will be used by reformail to save message IDs seen in recent mail. reformail reads the message on standard input. If the message has a Message-ID: header that's already in the cache file, reformail terminates with the exit code set to 0. Otherwise, reformail terminates with the exit code set to 1. Note Unlike a similar feature in the formail command, reformail takes care of locking the file, so it's not necessary to implement your own locking mechanism for this option. Extracting headers 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. The -x option extracts and prints the contents of the header. The -X option prints the name of the header as well. In all other situations, reformail copies the message on its standard input to its standard output, reformatting the message as follows:
-a'header: value' 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, reformail generates a (hopefully) unique message ID for you. -A'header: value' 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, reformail generates a (hopefully) unique message ID for you. -c Concatenate multi-line headers. Headers split on multiple lines are combined into a single line. -dn If n is 1, each line will be terminated with CRLF. If n is 0 (default), each line will be terminated with LF. reformail reads a message with either line terminator, and will force the message to have the specified line termination. -f0 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. -f1 Add the "From_" line to the message, if it's not there. reformail will attempt to generate the "From_" line from any Errors-To:, Return-Path:, or From: headers in the message. "root" will be used if reformail is unable to determine the return address. -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. -I'header: value' 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. -R oldheader: newheader: Rename the indicated header. -u'header:' If this header occurs multiple times in the message, remove all occurrences except the first one. -U'header:' If this header occurs multiple times in the message, remove all occurrences except the last one.
The autoreply options from earlier versions of mailbot have been moved into mailbot(1)[1].
For the -a, -A, and -I options, a space after the header name and the colon is considered to be a non-empty field. 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. It's better to run reformail several times (use a pipe, perhaps).
courier(8)[2], sendmail(8), mailbot(1)[1], maildrop(1)[3].
Sam Varshavchik Author
1. mailbot(1) http://www.courier-mta.org/maildrop/mailbot.html 2. courier(8) http://www.courier-mta.org/maildrop/courier.html 3. maildrop(1) http://www.courier-mta.org/maildrop/maildrop.html
Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.
Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.
Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.
Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.
The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.
Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.
Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.
Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.