Getting data out of Mozilla Thunderbird with Python?

Cameron Simpson cs at zip.com.au
Tue Dec 8 23:00:37 EST 2015


On 08Dec2015 12:21, Anthony Papillion <anthony at cajuntechie.org> wrote:
>I have a TON of email (years) stored in my Thunderbird. [...]
>I've been thinking about bringing Python into the mix to build a
>bridge between Thunderbird and SQLite or MySQL (probably sqlite) where
>all mail would be backed up to a database where I could run analytics
>against it and search it more effectively.
>
>I'm looking for a way to get at the mail stored in Thunderbird using
>Python and, so far, I can't find anything. I did find the mozmail
>package but it seems to be geared more towards testing and not really
>the kind of use I need.
>
>Can anyone suggest anything?

The local messges folders in Thunderbird are plain old mbox files IIRC. You can 
read these with the email.* modules and analyse them to your heart's content.

So I'd just write a Python program to read a single mbox file and break it into 
messages, make each one into an email Message object, and the process as you 
see fit.

Then point it at each of the TBird mbox files in turn.

Cheers,
Cameron Simpson <cs at zip.com.au>



More information about the Python-list mailing list