Thought I'd share this with everyone. I wanted to filter my emails from a particular sender, export it and put it together in a text file for reading chronologically.
Here's what I had:
- Ubuntu Lucid (10.4) as OS
- Mozilla Thunderbird 3.1.2 as email client
- w3m as a text-only browser
ImportExportTools as a Thunderbird add-on
The first part was fairly simple, just filter based on sender. In the search results, select all and click on Tools-ImportExportTools-Export All Messages In Folder - HTML Format
Select the target folder (I created a new one called EmailArchive). Once the activity is completed, you get a folder full of exported html files with names that have the date and subject as filename (you can customize this in preferences too).
Now I created a small shell script to achieve the next (but most difficult) part (for me). The script has the following lines: -
#!/bin/bash
FNAME=Mail_Transactions.txt
for i in *.html
do
echo "Start of Mail ---" $i >> $FNAME
echo "------" >> $FNAME
w3m -dump "$i" >> $FNAME
echo "End of Mail ------" >> $FNAME
echo "------" >> $FNAME
done
When you run this script (in a terminal , cd to the directory that contains the html files), it will create a file called Mail_Transactions.txt that will contain the output of all the mails separated by the two blocks "Start of Mail" and "End of Mail".
Hope this helps!