Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Get saved search data out of Thunderbird and into plain-text file

by Corion (Patriarch)
on Dec 22, 2021 at 15:09 UTC ( [id://11139836]=note: print w/replies, xml ) Need Help??


in reply to Get saved search data out of Thunderbird and into plain-text file

I'm not sure if Thunderbird stores the local copies as SQLite databases or the weirdo Mozilla internal format (Mork, more comments by jwz). According to some random comments on the internet, global-messages-db.sqlite in your profile directory is the index into all the (local) messages, so you might get by with running the SQL against that file (DBD::SQLite and/or my DBIx::RunSQL).

If you are lucky, getting the results is merely running the SQL query against the SQLite database in the INBOX file (which might be an SQLite database).

If you are unlucky, you need to read/import the Mork format into SQLite to then run the SQL query against that.

If you are adventurous, you can try to create a converter from SQL to IMAP queries to run the search query directly on the remote IMAP server, but I think that's the approach least likely to be successful.

Update:

Having looked at the .msf files, they seem to contain maybe IMAP queries, but certainly not SQL.

On the other hand, the global-messages-db.sqlite file in your profile contains basically a copy of all mails as a cache for Thunderbird.

I would look at querying that SQLite file. You might want to maybe find out how to make SQLite ignore locks on the sqlite database so that you can read it while Thunderbird is still running.

Replies are listed 'Best First'.
Re^2: Get saved search data out of Thunderbird and into plain-text file
by jkeenan1 (Deacon) on Dec 24, 2021 at 20:35 UTC
    Thanks, Fletch and Corion for your suggestions. (I haven't gotten to the other posts yet, as I just noticed them.)

    If this were a commercial project, I would definitely explore Mail::Box. However, as this is just a one-off for a friend, I was hoping to avoid having to learn that module or, for that matter, SQLite.

    By poking around in ~/.thunderbird, I've learned that Thunderbird stores most of its own data in SQLite3, but the Mork format which Corion mentioned. Again, more than I really want to learn. Fortunately, the contents of any given subfolder are stored in a plain-text file whose path looks something like:

    ~/.thunderbird/NNNNNsNn.default/ImapMail/mail.pobox.com/INBOX.sbd/subfolder_name

    ... which is what I'm now playing around with.

    Jim Keenan

      My guess (don't use Thunderbird) would be that's the mbox file which Mail::Box would read, but if you can kludge out what you're interested in that's probably enough for what you're trying to do.

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11139836]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-19 18:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found