Lubuntu/lxde – showing and opening eml files with thunderbird
Scenario:
You have windows xp with Thunderbird, and you have a habbit of organizing your emails by saving them into folders as my_email.eml files.
Then some day, windows xp starts to bog-down, and you decide it might be a good moment to try that “linux” your nephew says it’s so good with old pcs
So your nephew puts Lubuntu (which is like ubuntu with lxde instead of gnome) installed side-by-side with the windows xp, and also installs Thunderbird inside your linux.
You explain to your nephew that you want to:
- be able to see your same emails from both linux-thunderbird or from windows-thunderbird (just in case)
- keep opening and saving your emails as files inside folders
Solution for 1.
Explained in this post from askubuntu.com
Basically, maintain your existing thunderbird profile in windows, and in linux, configure $HOME/.thunderbird/profile.ini to point to the same windows profile
Solution for 2.
Now this is more tricky and it is the reason for sharing this post with anyone interested…
It comes in 2 parts:
Saving an email as a file
Opening an email from a file
This is the interesting part – in windows you had the habbit of simply opening up an explorer window of a folder, and then click-click the my_email.eml file, and thunderbird would open up the email – great.
Now in lubuntu, you open up an pcmanfm window of a folder, and when you click-click my_email.eml it gets open in gedit…
Your nephew says for you to go have a coffee while he fixes up things, and after some hours of reading and searching, your nephew ends up discovering some interesting things about what is going on between pcmanfm and thunderbird that explain why it did not opened as expected.
He first sets the option “Open With…” and makes Thunderbird the “default” the default application for .eml files – that was quick and easy, but it did not worked as expected: when click-clicked again over my_email.eml, nothing happens…
When pcmanfm tries to open my_email.eml, it calls the associated program, which by default is now Thunderbird
To know how to call Thunderbird, it reads the file:
/usr/share/applications/thunderbird.desktop
that indicates the Exec field:
Exec=thunderbird %u
So pcmanfm will execute
thunderbird %u
, where the %u is the URL of the my_email.eml file (see [1]) which is something like file:///mnt/Data/my_email.eml
And here is the problem – Thunderbird is not expecting an URL argument, it expects a PATH argument (like /mnt/Data/my_email.eml)
To fix it, you can edit as root “/usr/share/applications/thunderbird.desktop” and where it puts
Exec=thunderbird %u
add a %f in front of %u (see [1] ):
Exec=thunderbird %f %u
And from now on, the click-click of .eml files inside pcmanfm works as expected and opens up Thunderbird
BrainStorming and todos
The file “/usr/share/applications/thunderbird.desktop” is defined by freedesktop.org as are the related utilities xdg-open xdg-mime, xdg-…
What was made was a litle hack for thunderbird.desktop launcher to accept the %f argument sent by pcmanfm, instead of only getting the %u which would not work for this case
In the end although my_email.eml was opening well with thunderbird, it was still not being shown with the thunderbird icon inside pcmanfm – that is something to read about in freedesktop.org or maybe google, and try to fix manually – basically it should be something like associate to the mime-type of .elm files to the icon of thunderbird
Note that the xdg mechanisms are implemented by all desktop managers like gnome, kde, xfce, e17, lxde, … so this info is not limited to lubuntu/lxde, it is valid for all desktop managers. The idea is that each desktop manager, whatever it is, implements the “standards” of freedesktop and so obeys seeminglessly the xdg-open, xdg-mime, xdg-icon orders… this is why the same applications show up in the same place in the menu, with different desktop managers
Hope it helps someone – if it does, drop a comment, it cheers me up
[1] For more info about the Exec line, see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html
If you only have a few .eml files, a shortcut to viewing them would be to use the free online .eml file viewer at http://www.encryptomatic.com/viewer/
You can view the formatted email message and then download any file attachments through your browser. Not the answer if you have hundreds of .eml messages, but a nice shortcut if you only have a few.
August 28, 2012 at 04:38
Ok, thats good to know
September 16, 2012 at 21:43
Reblogged this on Gigable – Tech Blog.
August 31, 2012 at 13:20
Brilliant!! |Thank you – works well. Also, I was happy that Thunderbird just opens up a minimalist window – not the whole thunderbird with all the buttons .. good stuff
April 28, 2013 at 13:33
Great, I’m happy that it helped you too
May 3, 2013 at 17:31