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
|
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>reformime</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"/><link rel="start" href="#reformime" title="reformime"/><link xmlns="" rel="stylesheet" type="text/css" href="manpage.css"/><meta xmlns="" name="MSSmartTagsPreventParsing" content="TRUE"/><link xmlns="" rel="icon" href="icon.gif" type="image/gif"/><!--
Copyright 1998 - 2007 Double Precision, Inc. See COPYING for distribution
information.
--></head><body><div class="refentry" lang="en" xml:lang="en"><a id="reformime" shape="rect"> </a><div class="titlepage"/><div class="refnamediv"><h2>Name</h2><p>reformime — MIME E-mail reformatting tool</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">reformime</code> [<em class="replaceable"><code>options</code></em>...]</p></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="id281696" shape="rect"> </a><h2>DESCRIPTION</h2><p>
<span><strong class="command">reformime</strong></span> is a utility for reformatting
MIME messages.</p><p>
Generally, <span><strong class="command">reformime</strong></span> expects to see an
<a href="http://www.rfc-editor.org/rfc/rfc2045.txt" target="_top" shape="rect">RFC 2045</a>
compliant message on standard input, except in few cases
such as the <code class="option">-m</code> option.</p><p>
If no options are given, <span><strong class="command">reformime</strong></span> prints the MIME
structure of the message. The output consists of so-called
"MIME reference tags", one per line.
For example:</p><div class="blockquote"><blockquote class="blockquote"><div class="informalexample"><pre class="programlisting" xml:space="preserve">
1
1.1
1.2
</pre></div></blockquote></div><p>
This shows that the message contains two different MIME sections. The
first line of the MIME structure output will always contain "1", which refers
to the entire message.
In this case it happens to be a <code class="literal">multipart/mixed</code>
message. "1.1" refers to the first section of the multipart message, which
happens to be a
<code class="literal">text/plain</code> section. "1.2" refers to the second
section of the message, which happens to be an
<code class="literal">application/octet-stream</code> section.</p><p>
If the message is not a MIME message, or it does not contain any
attachments, <span><strong class="command">reformime</strong></span> prints only "1", that refers
to the entire message itself:
</p><div class="blockquote"><blockquote class="blockquote"><div class="informalexample"><pre class="programlisting" xml:space="preserve">
1
</pre></div></blockquote></div><p>
Here's the output from
<span><strong class="command">reformime</strong></span> when the first part of the message was itself a
<code class="literal">multipart/alternative</code> section:</p><div class="blockquote"><blockquote class="blockquote"><div class="informalexample"><pre class="programlisting" xml:space="preserve">
1
1.1
1.1.1
1.1.2
1.2
</pre></div></blockquote></div><p>
Arbitrarily complex MIME constructs are possible.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="id282618" shape="rect"> </a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">-d</span></dt><dd><p>
Parse a delivery status notification MIME message
(<a href="http://www.rfc-editor.org/rfc/rfc1894.txt" target="_top" shape="rect">RFC 1894</a>).
<span><strong class="command">reformime</strong></span>
expects to see on standard input a MIME message that consists of
a delivery status notification, as defined by RFC 1894.
<span><strong class="command">reformime</strong></span>
reads
the message and prints on standard output a list of addresses and their
corresponding delivery status, as specified in the delivery status
notification. Each line printed by
<span><strong class="command">reformime</strong></span>
consists of a delivery
status, a space, and the address.
<span><strong class="command">reformime</strong></span> then terminates with a 0 exit status.
<span><strong class="command">reformime</strong></span> produces no output and terminates with an exit
status of 1 if the standard input does not contain a delivery status
notification.</p></dd><dt><span class="term">-D</span></dt><dd><p>
Like the <code class="option">-d</code> except that
<span><strong class="command">reformime</strong></span> lists the address
found in the <code class="literal">Original-Recipient:</code> header,
if it exists.</p></dd><dt><span class="term">-e</span></dt><dd><p>
Extract the contents of the indicated MIME section, and display it
on standard output.
The <code class="option">-s</code> option is required when
<code class="option">-e</code> is specified. If the
indicated section uses either the <code class="literal">base64</code> or
<code class="literal">quoted-printable</code> encoding method,
<span><strong class="command">reformime</strong></span> automatically
decodes it. In this case you're better off redirecting the standard output
into a file.</p></dd><dt><span class="term">-i</span></dt><dd><p>
Display MIME information for each section. <span><strong class="command">reformime</strong></span>
displays the contents of the
<code class="literal">Content-Type:</code> header, any encoding used,
and the character set.
<span><strong class="command">reformime</strong></span> also displays the byte offset in the message
where each section starts and ends (and where the
actual contents of the section start, after skipping all the headers).</p></dd><dt><span class="term">-m</span></dt><dd><p>
Create a <code class="literal">multipart/digest</code> MIME message digest.</p></dd><dt><span class="term">-r</span></dt><dd><p>
Rewrite message, adding or standardizing
<a href="http://www.rfc-editor.org/rfc/rfc2045.txt" target="_top" shape="rect">RFC 2045</a>
MIME headers.</p></dd><dt><span class="term">-r7</span></dt><dd><p>
Like <code class="option">-r</code> but also convert <code class="literal">8bit</code>-encoded
MIME sections to <code class="literal">quoted-printable</code>.</p></dd><dt><span class="term">-r8</span></dt><dd><p>
Like <code class="option">-r</code> but also convert
<code class="literal">quoted-printable</code>-encoded MIME sections to
<code class="literal">8bit</code>.</p></dd><dt><span class="term">-s <em class="replaceable"><code>section</code></em></span></dt><dd><p>
Display MIME information for this section only.
<em class="replaceable"><code>section</code></em> is
a MIME specification tag. The <code class="option">-s</code> option is required if
<code class="option">-e</code> is also
specified, and is optional with <code class="option">-i</code>.</p></dd><dt><span class="term">-x</span></dt><dd><p>
Extract the contents of the indicated MIME section to a file.</p></dd><dt><span class="term">-X</span></dt><dd><p>
Pipe the contents of the indicated MIME section to a program.</p></dd></dl></div><div class="refsect2" lang="en" xml:lang="en"><a id="id325317" shape="rect"> </a><h3>Extracting RFC 2045 MIME section(s) to file(s)</h3><p>
The <code class="option">-x</code> and <code class="option">-X</code> options extract a specific
MIME section to a file or to a pipe to an external program.
Use the <code class="option">-s</code> option to identify the MIME section
to extract. If the <code class="option">-s</code> option is not specified,
every MIME section in the message is extracted, one at a time.
<code class="literal">quoted-printable</code> and <code class="literal">base64</code> encoding are
automatically decoded.</p><div class="variablelist"><dl><dt><span class="term">-x</span></dt><dd><p>
Interactive extraction. <span><strong class="command">reformime</strong></span> prints the MIME
content type of each section. Answer with 'y' or 'Y' to extract the MIME
section. Specify the filename at the next prompt. <span><strong class="command">reformime</strong></span>
prompts with a default filename.
<span><strong class="command">reformime</strong></span> tries to choose the default
filename based on the MIME headers, if possible. If not, the default
filename will be <code class="literal">attachment1.dat</code> (if the -s option is not
specified, the next filename will be <code class="literal">attachment2.dat</code>,
and so on).</p></dd><dt><span class="term">-x<em class="replaceable"><code>PREFIX</code></em></span></dt><dd><p>
Automatic extraction. <span><strong class="command">reformime</strong></span> automatically
extracts one or more MIME sections, and saves them to a file.
The filename is formed by taking
<em class="replaceable"><code>PREFIX</code></em>, and appending the default filename to it.
Note that there's no space between "-x" and "PREFIX". For example:</p><div class="blockquote"><blockquote class="blockquote"><div class="informalexample"><pre class="programlisting" xml:space="preserve">
reformime -xfiles-
</pre></div></blockquote></div><p>
This command saves MIME sections as
<code class="filename">files-attachment1.dat</code>, then
<code class="filename">files-attachment2.dat</code>, etc.
<span><strong class="command">reformime</strong></span> tries to append the filename specified in the
MIME headers for each section, where possible.
<span><strong class="command">reformime</strong></span> replaces all suspect characters with the
underscore character.</p></dd><dt><span class="term">-X prog arg1 arg2 ...</span></dt><dd><p>
The <code class="option">-X</code> option must be the last option to
<span><strong class="command">reformime</strong></span>. <span><strong class="command">reformime</strong></span> runs an external
program <span><strong class="command">prog</strong></span>, and pipes the contents of the MIME section to
the program. <span><strong class="command">reformime</strong></span> sets the environment variable
<code class="envar">CONTENT_TYPE</code> to the MIME content type. The environment
variable <code class="envar">FILENAME</code> gets set to the default filename of
<span><strong class="command">reformime</strong></span>'s liking. If the <code class="option">-s</code> option is
not specified, the program runs once
for every MIME section in the message.
The external program, <span><strong class="command">prog</strong></span> must terminate with a zero
exit status in order for <span><strong class="command">reformime</strong></span> to proceed to the
next MIME section in the message.
In any case, if <span><strong class="command">prog</strong></span> terminates with a non-zero exit
status, <span><strong class="command">reformime</strong></span> terminates with the exit status of
20 plus <span><strong class="command">prog</strong></span>'s exit status.</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
<span><strong class="command">reformime</strong></span> extracts every MIME section in the message
unless the <code class="option">-s</code> option is specified.
This includes even the <code class="literal">text/plain</code> MIME
content that usually precedes a binary attachment.</p></div></div><div class="refsect2" lang="en" xml:lang="en"><a id="id325585" shape="rect"> </a><h3>Adding RFC 2045 MIME headers</h3><p>
The <code class="option">-r</code> option performs the following actions:</p><p>
If there is no <code class="literal">Mime-Version:</code>,
<code class="literal">Content-Type:</code>, or
<code class="literal">Content-Transfer-Encoding:</code> header,
<span><strong class="command">reformime</strong></span> adds one.</p><p>
If the <code class="literal">Content-Transfer-Encoding:</code> header contains
<code class="literal">8bit</code> or <code class="literal">raw</code>, but only seven-bit data is
found, <span><strong class="command">reformime</strong></span> changes
the <code class="literal">Content-Transfer-Encoding</code> header to
<code class="literal">7bit</code>.</p><p><code class="option">-r7</code> does the same thing, but also converts
<code class="literal">8bit</code>-encoded content that contains eight-bit characters to
<code class="literal">quoted-printable</code> encoding.</p><p><code class="option">-r8</code> does the same thing, but also converts
<code class="literal">quoted-printable</code>-encoded content to
<code class="literal">8bit</code>, except in some situations.</p></div><div class="refsect2" lang="en" xml:lang="en"><a id="id325702" shape="rect"> </a><h3>Creating <code class="literal">multipart/digest</code> MIME digests</h3><p>The <code class="option">-m</code> option creates a MIME digest.
<span><strong class="command">reformime</strong></span> reads a list of filenames on standard input.
Each line read from standard input contains the name of a file that is
presumed to contain an RFC 2822-formatted message.
<span><strong class="command">reformime</strong></span> splices all files into a
<span><strong class="command">multipart/digest</strong></span> MIME section,
and writes it to standard output.</p></div><div class="refsect2" lang="en" xml:lang="en"><a id="id325741" shape="rect"> </a><h3>Translating MIME headers</h3><p>
The following options do not read a message from standard input.
These options process MIME headers via the command line, and are designed
to be conveniently used by mail-handling scripts.</p><div class="variablelist"><dl><dt><span class="term">-h "<em class="replaceable"><code>header</code></em>"</span></dt><dd><p>
Decode a MIME-encoded "<em class="replaceable"><code>header</code></em>" and print the
decoded 8-bit content on standard output. Example:</p><div class="informalexample"><pre class="programlisting" xml:space="preserve">
$ reformime -h '=?iso-8859-1?Q?H=F3la!?='
Hóla!
</pre></div></dd><dt><span class="term">-o "<em class="replaceable"><code>text</code></em>"</span></dt><dd><p>
MIME-encode "<em class="replaceable"><code>text</code></em>", and print the results
on standard output.
Use the <code class="option">-c</code> option to specify the character set.</p></dd><dt><span class="term">-O "<em class="replaceable"><code>text</code></em>"</span></dt><dd><p>
Like the <code class="option">-o option</code>, except that
<em class="replaceable"><code>text</code></em>
is a structured header with RFC 2822 addresses.</p></dd></dl></div></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="id325839" shape="rect"> </a><h2>SEE ALSO</h2><p>
<a href="reformail.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">reformail</span>(1)</span></a>,
<span class="citerefentry"><span class="refentrytitle">sendmail</span>(8)</span>,
<a href="mailbot.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">mailbot</span>(1)</span></a>,
<a href="maildrop.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">maildrop</span>(1)</span></a>,
<a href="maildropfilter.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">maildropfilter</span>(5)</span></a>,
<span class="citerefentry"><span class="refentrytitle">egrep</span>(1)</span>,
<span class="citerefentry"><span class="refentrytitle">grep</span>(1)</span>,
<span class="citerefentry"><span class="refentrytitle">sendmail</span>(8)</span>.</p></div></div></body></html>
|