Top-rated recipes tagged "mbox" but not "tb"http://code.activestate.com/recipes/tags/mbox-tb/top/2013-09-07T10:24:17-07:00ActiveState Code RecipesCreate a temporary mailbox (Python)
2013-04-29T14:04:20-07:00Noufal Ibrahimhttp://code.activestate.com/recipes/users/4173873/http://code.activestate.com/recipes/578514-create-a-temporary-mailbox/
<p style="color: grey">
Python
recipe 578514
by <a href="/recipes/users/4173873/">Noufal Ibrahim</a>
(<a href="/recipes/tags/mail/">mail</a>, <a href="/recipes/tags/mbox/">mbox</a>).
</p>
<p>Generates a mailbox with lots of messages.</p>
extract emails from a mbox read on stdin (Python)
2013-09-07T10:24:17-07:00Romain Dartigueshttp://code.activestate.com/recipes/users/4167472/http://code.activestate.com/recipes/576553-extract-emails-from-a-mbox-read-on-stdin/
<p style="color: grey">
Python
recipe 576553
by <a href="/recipes/users/4167472/">Romain Dartigues</a>
(<a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/generators/">generators</a>, <a href="/recipes/tags/mbox/">mbox</a>, <a href="/recipes/tags/read_only/">read_only</a>, <a href="/recipes/tags/stdin/">stdin</a>).
Revision 2.
</p>
<p>The Python <code>mailbox.mbox</code> class require a real file to initialize, which was an issue in my case. These simple functions let you iter through a mailbox read from a read-only file descriptor (like <code>sys.stdin</code>).</p>
<p>This script use the generators which were introduced in Python-2.2. Let me know if you are interested a similar functionnality on older Python versions.</p>
Fix invalid mail headers when moving from Thunderbird to IMAP (Python)
2008-08-30T20:08:02-07:00Krys Wilkenhttp://code.activestate.com/recipes/users/4166805/http://code.activestate.com/recipes/576471-fix-invalid-mail-headers-when-moving-from-thunderb/
<p style="color: grey">
Python
recipe 576471
by <a href="/recipes/users/4166805/">Krys Wilken</a>
(<a href="/recipes/tags/cyrus/">cyrus</a>, <a href="/recipes/tags/header/">header</a>, <a href="/recipes/tags/imap/">imap</a>, <a href="/recipes/tags/invalid/">invalid</a>, <a href="/recipes/tags/mail/">mail</a>, <a href="/recipes/tags/maildir/">maildir</a>, <a href="/recipes/tags/mbox/">mbox</a>, <a href="/recipes/tags/thunderbird/">thunderbird</a>).
</p>
<p>Removes ">From" and "From " lines from mail headers.</p>
<p>Thunderbird adds invalid mail headers to it's local folders. Cyrus IMAP is strict about them. This script walks through all files in the given directories and removes any line that starts with ">From" or "From " (note the space and no colon).</p>
<p>Requires Python 2.5+.</p>