| 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="node597.html" /> |
| 13 | <link rel="prev" href="node595.html" /> |
| 14 | <link rel="parent" href="module-email.html" /> |
| 15 | <link rel="next" href="node597.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>12.2.12 Differences from mimelib</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.2.11 Package History" |
| 25 | href="node595.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.2 email " |
| 28 | href="module-email.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.2.13 Examples" |
| 31 | href="node597.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="node595.html">12.2.11 Package History</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="module-email.html">12.2 email </A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="node597.html">12.2.13 Examples</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H2><A NAME="SECTION00142120000000000000000"> |
| 56 | 12.2.12 Differences from <tt class="module">mimelib</tt></A> |
| 57 | </H2> |
| 58 | |
| 59 | <P> |
| 60 | The <tt class="module">email</tt> package was originally prototyped as a separate |
| 61 | library called |
| 62 | <a class="ulink" href="http://mimelib.sf.net/" |
| 63 | ><tt class="module">mimelib</tt></a>. |
| 64 | Changes have been made so that |
| 65 | method names are more consistent, and some methods or modules have |
| 66 | either been added or removed. The semantics of some of the methods |
| 67 | have also changed. For the most part, any functionality available in |
| 68 | <tt class="module">mimelib</tt> is still available in the <tt class="module"><a href="module-email.html">email</a></tt> package, |
| 69 | albeit often in a different way. Backward compatibility between |
| 70 | the <tt class="module">mimelib</tt> package and the <tt class="module">email</tt> package was not a |
| 71 | priority. |
| 72 | |
| 73 | <P> |
| 74 | Here is a brief description of the differences between the |
| 75 | <tt class="module">mimelib</tt> and the <tt class="module"><a href="module-email.html">email</a></tt> packages, along with hints on |
| 76 | how to port your applications. |
| 77 | |
| 78 | <P> |
| 79 | Of course, the most visible difference between the two packages is |
| 80 | that the package name has been changed to <tt class="module"><a href="module-email.html">email</a></tt>. In |
| 81 | addition, the top-level package has the following differences: |
| 82 | |
| 83 | <P> |
| 84 | |
| 85 | <UL> |
| 86 | <LI><tt class="function">messageFromString()</tt> has been renamed to |
| 87 | <tt class="function">message_from_string()</tt>. |
| 88 | |
| 89 | <P> |
| 90 | </LI> |
| 91 | <LI><tt class="function">messageFromFile()</tt> has been renamed to |
| 92 | <tt class="function">message_from_file()</tt>. |
| 93 | |
| 94 | <P> |
| 95 | </LI> |
| 96 | </UL> |
| 97 | |
| 98 | <P> |
| 99 | The <tt class="class">Message</tt> class has the following differences: |
| 100 | |
| 101 | <P> |
| 102 | |
| 103 | <UL> |
| 104 | <LI>The method <tt class="method">asString()</tt> was renamed to <tt class="method">as_string()</tt>. |
| 105 | |
| 106 | <P> |
| 107 | </LI> |
| 108 | <LI>The method <tt class="method">ismultipart()</tt> was renamed to |
| 109 | <tt class="method">is_multipart()</tt>. |
| 110 | |
| 111 | <P> |
| 112 | </LI> |
| 113 | <LI>The <tt class="method">get_payload()</tt> method has grown a <var>decode</var> |
| 114 | optional argument. |
| 115 | |
| 116 | <P> |
| 117 | </LI> |
| 118 | <LI>The method <tt class="method">getall()</tt> was renamed to <tt class="method">get_all()</tt>. |
| 119 | |
| 120 | <P> |
| 121 | </LI> |
| 122 | <LI>The method <tt class="method">addheader()</tt> was renamed to <tt class="method">add_header()</tt>. |
| 123 | |
| 124 | <P> |
| 125 | </LI> |
| 126 | <LI>The method <tt class="method">gettype()</tt> was renamed to <tt class="method">get_type()</tt>. |
| 127 | |
| 128 | <P> |
| 129 | </LI> |
| 130 | <LI>The method <tt class="method">getmaintype()</tt> was renamed to |
| 131 | <tt class="method">get_main_type()</tt>. |
| 132 | |
| 133 | <P> |
| 134 | </LI> |
| 135 | <LI>The method <tt class="method">getsubtype()</tt> was renamed to |
| 136 | <tt class="method">get_subtype()</tt>. |
| 137 | |
| 138 | <P> |
| 139 | </LI> |
| 140 | <LI>The method <tt class="method">getparams()</tt> was renamed to |
| 141 | <tt class="method">get_params()</tt>. |
| 142 | Also, whereas <tt class="method">getparams()</tt> returned a list of strings, |
| 143 | <tt class="method">get_params()</tt> returns a list of 2-tuples, effectively |
| 144 | the key/value pairs of the parameters, split on the "<tt class="character">=</tt>" |
| 145 | sign. |
| 146 | |
| 147 | <P> |
| 148 | </LI> |
| 149 | <LI>The method <tt class="method">getparam()</tt> was renamed to <tt class="method">get_param()</tt>. |
| 150 | |
| 151 | <P> |
| 152 | </LI> |
| 153 | <LI>The method <tt class="method">getcharsets()</tt> was renamed to |
| 154 | <tt class="method">get_charsets()</tt>. |
| 155 | |
| 156 | <P> |
| 157 | </LI> |
| 158 | <LI>The method <tt class="method">getfilename()</tt> was renamed to |
| 159 | <tt class="method">get_filename()</tt>. |
| 160 | |
| 161 | <P> |
| 162 | </LI> |
| 163 | <LI>The method <tt class="method">getboundary()</tt> was renamed to |
| 164 | <tt class="method">get_boundary()</tt>. |
| 165 | |
| 166 | <P> |
| 167 | </LI> |
| 168 | <LI>The method <tt class="method">setboundary()</tt> was renamed to |
| 169 | <tt class="method">set_boundary()</tt>. |
| 170 | |
| 171 | <P> |
| 172 | </LI> |
| 173 | <LI>The method <tt class="method">getdecodedpayload()</tt> was removed. To get |
| 174 | similar functionality, pass the value 1 to the <var>decode</var> flag |
| 175 | of the get_payload() method. |
| 176 | |
| 177 | <P> |
| 178 | </LI> |
| 179 | <LI>The method <tt class="method">getpayloadastext()</tt> was removed. Similar |
| 180 | functionality |
| 181 | is supported by the <tt class="class">DecodedGenerator</tt> class in the |
| 182 | <tt class="module"><a href="module-email.Generator.html">email.Generator</a></tt> module. |
| 183 | |
| 184 | <P> |
| 185 | </LI> |
| 186 | <LI>The method <tt class="method">getbodyastext()</tt> was removed. You can get |
| 187 | similar functionality by creating an iterator with |
| 188 | <tt class="function">typed_subpart_iterator()</tt> in the |
| 189 | <tt class="module"><a href="module-email.Iterators.html">email.Iterators</a></tt> module. |
| 190 | </LI> |
| 191 | </UL> |
| 192 | |
| 193 | <P> |
| 194 | The <tt class="class">Parser</tt> class has no differences in its public interface. |
| 195 | It does have some additional smarts to recognize |
| 196 | <span class="mimetype">message/delivery-status</span> type messages, which it represents as |
| 197 | a <tt class="class">Message</tt> instance containing separate <tt class="class">Message</tt> |
| 198 | subparts for each header block in the delivery status |
| 199 | notification<A NAME="tex2html135" |
| 200 | HREF="#foot58638"><SUP>12.4</SUP></A>. |
| 201 | |
| 202 | <P> |
| 203 | The <tt class="class">Generator</tt> class has no differences in its public |
| 204 | interface. There is a new class in the <tt class="module"><a href="module-email.Generator.html">email.Generator</a></tt> |
| 205 | module though, called <tt class="class">DecodedGenerator</tt> which provides most of |
| 206 | the functionality previously available in the |
| 207 | <tt class="method">Message.getpayloadastext()</tt> method. |
| 208 | |
| 209 | <P> |
| 210 | The following modules and classes have been changed: |
| 211 | |
| 212 | <P> |
| 213 | |
| 214 | <UL> |
| 215 | <LI>The <tt class="class">MIMEBase</tt> class constructor arguments <var>_major</var> |
| 216 | and <var>_minor</var> have changed to <var>_maintype</var> and |
| 217 | <var>_subtype</var> respectively. |
| 218 | |
| 219 | <P> |
| 220 | </LI> |
| 221 | <LI>The <code>Image</code> class/module has been renamed to |
| 222 | <code>MIMEImage</code>. The <var>_minor</var> argument has been renamed to |
| 223 | <var>_subtype</var>. |
| 224 | |
| 225 | <P> |
| 226 | </LI> |
| 227 | <LI>The <code>Text</code> class/module has been renamed to |
| 228 | <code>MIMEText</code>. The <var>_minor</var> argument has been renamed to |
| 229 | <var>_subtype</var>. |
| 230 | |
| 231 | <P> |
| 232 | </LI> |
| 233 | <LI>The <code>MessageRFC822</code> class/module has been renamed to |
| 234 | <code>MIMEMessage</code>. Note that an earlier version of |
| 235 | <tt class="module">mimelib</tt> called this class/module <code>RFC822</code>, but |
| 236 | that clashed with the Python standard library module |
| 237 | <tt class="module"><a href="module-rfc822.html">rfc822</a></tt> on some case-insensitive file systems. |
| 238 | |
| 239 | <P> |
| 240 | Also, the <tt class="class">MIMEMessage</tt> class now represents any kind of |
| 241 | MIME message with main type <span class="mimetype">message</span>. It takes an |
| 242 | optional argument <var>_subtype</var> which is used to set the MIME |
| 243 | subtype. <var>_subtype</var> defaults to <span class="mimetype">rfc822</span>. |
| 244 | </LI> |
| 245 | </UL> |
| 246 | |
| 247 | <P> |
| 248 | <tt class="module">mimelib</tt> provided some utility functions in its |
| 249 | <tt class="module">address</tt> and <tt class="module">date</tt> modules. All of these functions |
| 250 | have been moved to the <tt class="module"><a href="module-email.Utils.html">email.Utils</a></tt> module. |
| 251 | |
| 252 | <P> |
| 253 | The <code>MsgReader</code> class/module has been removed. Its functionality |
| 254 | is most closely supported in the <tt class="function">body_line_iterator()</tt> |
| 255 | function in the <tt class="module"><a href="module-email.Iterators.html">email.Iterators</a></tt> module. |
| 256 | |
| 257 | <P> |
| 258 | <BR><HR><H4>Footnotes</H4> |
| 259 | <DL> |
| 260 | <DT><A NAME="foot58638">... |
| 261 | notification</A><A |
| 262 | HREF="node596.html#tex2html135"><SUP>12.4</SUP></A></DT> |
| 263 | <DD>Delivery Status Notifications (DSN) are defined |
| 264 | in <a class="rfc" id='rfcref-91000' xml:id='rfcref-91000' |
| 265 | href="http://www.faqs.org/rfcs/rfc1894.html">RFC 1894</a>. |
| 266 | |
| 267 | </DD> |
| 268 | </DL> |
| 269 | <DIV CLASS="navigation"> |
| 270 | <div class='online-navigation'> |
| 271 | <p></p><hr /> |
| 272 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 273 | <tr> |
| 274 | <td class='online-navigation'><a rel="prev" title="12.2.11 Package History" |
| 275 | href="node595.html"><img src='../icons/previous.png' |
| 276 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 277 | <td class='online-navigation'><a rel="parent" title="12.2 email " |
| 278 | href="module-email.html"><img src='../icons/up.png' |
| 279 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 280 | <td class='online-navigation'><a rel="next" title="12.2.13 Examples" |
| 281 | href="node597.html"><img src='../icons/next.png' |
| 282 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 283 | <td align="center" width="100%">Python Library Reference</td> |
| 284 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 285 | href="contents.html"><img src='../icons/contents.png' |
| 286 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 287 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 288 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 289 | <td class='online-navigation'><a rel="index" title="Index" |
| 290 | href="genindex.html"><img src='../icons/index.png' |
| 291 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 292 | </tr></table> |
| 293 | <div class='online-navigation'> |
| 294 | <b class="navlabel">Previous:</b> |
| 295 | <a class="sectref" rel="prev" href="node595.html">12.2.11 Package History</A> |
| 296 | <b class="navlabel">Up:</b> |
| 297 | <a class="sectref" rel="parent" href="module-email.html">12.2 email </A> |
| 298 | <b class="navlabel">Next:</b> |
| 299 | <a class="sectref" rel="next" href="node597.html">12.2.13 Examples</A> |
| 300 | </div> |
| 301 | </div> |
| 302 | <hr /> |
| 303 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 304 | </DIV> |
| 305 | <!--End of Navigation Panel--> |
| 306 | <ADDRESS> |
| 307 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 308 | </ADDRESS> |
| 309 | </BODY> |
| 310 | </HTML> |