I have been using Thunderbird for a long time. I am looking for a way to parse a mboxrd format mail file (like <tb_profile>/ImapMail/<ESP_IMAP>/INBOX
) from outside Thunderbird using a Linux bash script that I can manage myself. The goal is to extract the mail bodies and the same metadata as those found in global-messages-db.sqlite
(aka gloda) which would be presented in clear without accents and encoding problems.
So I tried to write some scripts with commands like gawk, tr and others.
I quickly realized that between the different MIME encodings such as content-type and content-transfer-encoding, character sets being Unicode or not, the RFC standards that changed (before we could write a content-type on several lines as explained here), the multipart mail it was a huge shambles to parse. So I wondered if I was not reinventing the wheel and a better possibility existed.
I know I could parse the source code of Thunderbird as I have a little programming experience to determine what is going on behind the scenes when viewing the content of an IMAP folder for example but I do not know where to start. Mainly I wonder if I can not directly use an executable file or the functions of a SO library under Linux which are embedded in Thunderbird.