Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / lib / module-mimify.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="module-multifile.html" />
13<link rel="prev" href="module-MimeWriter.html" />
14<link rel="parent" href="netdata.html" />
15<link rel="next" href="module-multifile.html" />
16<meta name='aesop' content='information' />
17<title>12.9 mimify -- MIME processing of mail messages</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="12.8.1 MimeWriter Objects"
25 href="MimeWriter-objects.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="12. Internet Data Handling"
28 href="netdata.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="12.10 multifile "
31 href="module-multifile.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="MimeWriter-objects.html">12.8.1 MimeWriter Objects</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="netdata.html">12. Internet Data Handling</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="module-multifile.html">12.10 multifile </A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H1><A NAME="SECTION0014900000000000000000">
5612.9 <tt class="module">mimify</tt> --
57 MIME processing of mail messages</A>
58</H1>
59
60<P>
61<A NAME="module-mimify"></A>
62
63<P>
64<div class="versionnote"><b>Deprecated since release 2.3.</b>
65The <tt class="module"><a href="module-email.html">email</a></tt> package should be used in
66 preference to the <tt class="module">mimify</tt> module. This
67 module is present only to maintain backward
68 compatibility.</div><p></p>
69
70<P>
71The <tt class="module">mimify</tt> module defines two functions to convert mail messages to
72and from MIME format. The mail message can be either a simple message
73or a so-called multipart message. Each part is treated separately.
74Mimifying (a part of) a message entails encoding the message as
75quoted-printable if it contains any characters that cannot be
76represented using 7-bit ASCII. Unmimifying (a part of) a message
77entails undoing the quoted-printable encoding. Mimify and unmimify
78are especially useful when a message has to be edited before being
79sent. Typical use would be:
80
81<P>
82<div class="verbatim"><pre>
83unmimify message
84edit message
85mimify message
86send message
87</pre></div>
88
89<P>
90The modules defines the following user-callable functions and
91user-settable variables:
92
93<P>
94<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
95 <td><nobr><b><tt id='l2h-4052' xml:id='l2h-4052' class="function">mimify</tt></b>(</nobr></td>
96 <td><var>infile, outfile</var>)</td></tr></table></dt>
97<dd>
98Copy the message in <var>infile</var> to <var>outfile</var>, converting parts to
99quoted-printable and adding MIME mail headers when necessary.
100<var>infile</var> and <var>outfile</var> can be file objects (actually, any
101object that has a <tt class="method">readline()</tt> method (for <var>infile</var>) or a
102<tt class="method">write()</tt> method (for <var>outfile</var>)) or strings naming the files.
103If <var>infile</var> and <var>outfile</var> are both strings, they may have the
104same value.
105</dl>
106
107<P>
108<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
109 <td><nobr><b><tt id='l2h-4053' xml:id='l2h-4053' class="function">unmimify</tt></b>(</nobr></td>
110 <td><var>infile, outfile</var><big>[</big><var>, decode_base64</var><big>]</big><var></var>)</td></tr></table></dt>
111<dd>
112Copy the message in <var>infile</var> to <var>outfile</var>, decoding all
113quoted-printable parts. <var>infile</var> and <var>outfile</var> can be file
114objects (actually, any object that has a <tt class="method">readline()</tt> method (for
115<var>infile</var>) or a <tt class="method">write()</tt> method (for <var>outfile</var>)) or strings
116naming the files. If <var>infile</var> and <var>outfile</var> are both strings,
117they may have the same value.
118If the <var>decode_base64</var> argument is provided and tests true, any
119parts that are coded in the base64 encoding are decoded as well.
120</dl>
121
122<P>
123<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
124 <td><nobr><b><tt id='l2h-4054' xml:id='l2h-4054' class="function">mime_decode_header</tt></b>(</nobr></td>
125 <td><var>line</var>)</td></tr></table></dt>
126<dd>
127Return a decoded version of the encoded header line in <var>line</var>.
128This only supports the ISO 8859-1 charset (Latin-1).
129</dl>
130
131<P>
132<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
133 <td><nobr><b><tt id='l2h-4055' xml:id='l2h-4055' class="function">mime_encode_header</tt></b>(</nobr></td>
134 <td><var>line</var>)</td></tr></table></dt>
135<dd>
136Return a MIME-encoded version of the header line in <var>line</var>.
137</dl>
138
139<P>
140<dl><dt><b><tt id='l2h-4056' xml:id='l2h-4056'>MAXLEN</tt></b></dt>
141<dd>
142By default, a part will be encoded as quoted-printable when it
143contains any non-ASCII characters (characters with the 8th bit
144set), or if there are any lines longer than <tt class="constant">MAXLEN</tt> characters
145(default value 200).
146</dd></dl>
147
148<P>
149<dl><dt><b><tt id='l2h-4057' xml:id='l2h-4057'>CHARSET</tt></b></dt>
150<dd>
151When not specified in the mail headers, a character set must be filled
152in. The string used is stored in <tt class="constant">CHARSET</tt>, and the default
153value is ISO-8859-1 (also known as Latin1 (latin-one)).
154</dd></dl>
155
156<P>
157This module can also be used from the command line. Usage is as
158follows:
159<div class="verbatim"><pre>
160mimify.py -e [-l length] [infile [outfile]]
161mimify.py -d [-b] [infile [outfile]]
162</pre></div>
163to encode (mimify) and decode (unmimify) respectively. <var>infile</var>
164defaults to standard input, <var>outfile</var> defaults to standard output.
165The same file can be specified for input and output.
166
167<P>
168If the <strong>-l</strong> option is given when encoding, if there are any lines
169longer than the specified <var>length</var>, the containing part will be
170encoded.
171
172<P>
173If the <strong>-b</strong> option is given when decoding, any base64 parts will
174be decoded as well.
175
176<P>
177<div class="seealso">
178 <p class="heading">See Also:</p>
179
180 <dl compact="compact" class="seemodule">
181 <dt>Module <b><tt class="module"><a href="module-quopri.html">quopri</a></tt>:</b>
182 <dd>Encode and decode MIME quoted-printable files.
183 </dl>
184</div>
185
186<DIV CLASS="navigation">
187<div class='online-navigation'>
188<p></p><hr />
189<table align="center" width="100%" cellpadding="0" cellspacing="2">
190<tr>
191<td class='online-navigation'><a rel="prev" title="12.8.1 MimeWriter Objects"
192 href="MimeWriter-objects.html"><img src='../icons/previous.png'
193 border='0' height='32' alt='Previous Page' width='32' /></A></td>
194<td class='online-navigation'><a rel="parent" title="12. Internet Data Handling"
195 href="netdata.html"><img src='../icons/up.png'
196 border='0' height='32' alt='Up One Level' width='32' /></A></td>
197<td class='online-navigation'><a rel="next" title="12.10 multifile "
198 href="module-multifile.html"><img src='../icons/next.png'
199 border='0' height='32' alt='Next Page' width='32' /></A></td>
200<td align="center" width="100%">Python Library Reference</td>
201<td class='online-navigation'><a rel="contents" title="Table of Contents"
202 href="contents.html"><img src='../icons/contents.png'
203 border='0' height='32' alt='Contents' width='32' /></A></td>
204<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
205 border='0' height='32' alt='Module Index' width='32' /></a></td>
206<td class='online-navigation'><a rel="index" title="Index"
207 href="genindex.html"><img src='../icons/index.png'
208 border='0' height='32' alt='Index' width='32' /></A></td>
209</tr></table>
210<div class='online-navigation'>
211<b class="navlabel">Previous:</b>
212<a class="sectref" rel="prev" href="MimeWriter-objects.html">12.8.1 MimeWriter Objects</A>
213<b class="navlabel">Up:</b>
214<a class="sectref" rel="parent" href="netdata.html">12. Internet Data Handling</A>
215<b class="navlabel">Next:</b>
216<a class="sectref" rel="next" href="module-multifile.html">12.10 multifile </A>
217</div>
218</div>
219<hr />
220<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
221</DIV>
222<!--End of Navigation Panel-->
223<ADDRESS>
224See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
225</ADDRESS>
226</BODY>
227</HTML>