Popular Python recipes tagged "thunderbird"http://code.activestate.com/recipes/langs/python/tags/thunderbird/2010-05-02T13:21:00-07:00ActiveState Code RecipesFix mbox files after importing EML into TB using ImportExportTools (Python) 2010-05-02T13:21:00-07:00Denis Barmenkovhttp://code.activestate.com/recipes/users/57155/http://code.activestate.com/recipes/577214-fix-mbox-files-after-importing-eml-into-tb-using-i/ <p style="color: grey"> Python recipe 577214 by <a href="/recipes/users/57155/">Denis Barmenkov</a> (<a href="/recipes/tags/eml/">eml</a>, <a href="/recipes/tags/from/">from</a>, <a href="/recipes/tags/import/">import</a>, <a href="/recipes/tags/importexporttools/">importexporttools</a>, <a href="/recipes/tags/mbox/">mbox</a>, <a href="/recipes/tags/tb/">tb</a>, <a href="/recipes/tags/thunderbird/">thunderbird</a>). Revision 2. </p> <p>I've found a bug in import EML file into Thunderbird using ImportExportTools addon: when I import eml file into TB there are a 'From' line added to mbox followed with EML file contents. TB maintains right 'From' line for messages fetched from mailservers:</p> <pre class="prettyprint"><code>From - Tue Apr 27 19:42:22 2010 </code></pre> <p>ImportExportTools formats this line wrong I suppose that used some system function with default specifier so I saw in mbox file:</p> <pre class="prettyprint"><code>From - Sat May 01 2010 15:07:31 GMT+0400 (Russian Daylight Time) </code></pre> <p>So there are two errors: 1) sequence 'time year' broken into 'year time' 2) extra trash with GMT info along with time zone name</p> <p>This prevents the mbox file parsing using Python standard library (for sample) because there are a hardcoded regexp for matching From line (file lib/mailbox.py, class UnixMailbox):</p> <pre class="prettyprint"><code>_fromlinepattern = r"From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+" \ r"\d?\d:\d\d(:\d\d)?(\s+[^\s]+)?\s+\d\d\d\d\s*$" </code></pre> <p>Attached script fixes incorrect From lines so parsing those mboxes using Python standard library will become ok.</p> Detach Thunderbird emails and keep links (Python) 2009-05-11T02:38:47-07:00Jice Clavierhttp://code.activestate.com/recipes/users/4089467/http://code.activestate.com/recipes/576749-detach-thunderbird-emails-and-keep-links/ <p style="color: grey"> Python recipe 576749 by <a href="/recipes/users/4089467/">Jice Clavier</a> (<a href="/recipes/tags/detach/">detach</a>, <a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/thunderbird/">thunderbird</a>). </p> <p>For some people, thunderbird lacks of a powerfull automatic detach function that keeps the link to the detached file from the mail itself (like Eudora has). Some plugins exists but there is now way to detach a document and replace it with a link to it's new location. For security reasons, the developper team doesn't want to allow the opening of a local file from thunderbird. When you have to keep large history of your emails, this may become a real problem for the size of your box and the facilities to automate some tasks on files (you can't use programs to see if you have doubles and so on). If, like me, you want to keep your email box as slim as possible by detaching attached documents and keep links to the detached files, this may be for you.</p> <p>The trick is that the file is detached and replaced by an html one in which you'll find the link to the file. The html file will be opened in your browser where the link to your local filesystem will operate.</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>