Diary and notebook of whatever tech problems are irritating me at the moment.


Extracting EML files

EML files are a problem for some of my users on Ubuntu. They receive these as Email attachments but can only view them as text (usually in gedit) even if they contain pictures. The senders are probably using Outlook Express or a related mail application to attach them. While some non-Microsoft mail clients can open them properly this is a hassle for my users as they all use web mail. There is a command-line tool, munpack, that will extract non-text objects automatically (part of the mpack package in Ubuntu/Debian). To make it easier for them I wrote a little script that integrates munpack with their file manager via a mime type association. To use it, download munpack_eml and extract the files. Put munpack_eml in /usr/local/bin with root ownership and u=rwx,go=rx (0755) permissions. Put munpack_eml.desktop in /usr/local/share/applicatons with root ownership and u=rw,go=r (0644) permissions. Then right-click on any *.eml file from your file manager and you should see and option to extract the contents with munpack.


Saint DanBert said...

Regardless of which email reader app one uses on linux, there are times we want or need to "Save All" for an email thread and its attachments. HINT: Using EPUB format might be interesting.

Once saved, one clearly needs to be able to retrieve things AND to access the included attachments.

There are still times when one needs to make (1)dead-tree copies, or (2) PDF copies of the whole thing.

It would be nice if these activities were easy to accomplish and available for the majority of email readers.

Gelu Botezan said...

I just thought I found the solution for my .eml probs but trying to extract directly to /usr/local/ ... and so on, I get denied while not having permission. Do I need to learn command line in order to move the files to the respective directories?

jhansonxi said...

Yes and no. Those locations are writable by the root account only. This is fundamental to Linux security because it prevents malware in one user's home directory from directly affecting all other users via system files. Many Linux distributions disable direct root logins to encourage safe usage so a command line is often the easiest way to get root access. On Ubuntu derivatives, entering "sudo su" in a terminal window will give you root access when you enter your password. Your login account has to be in the "admin" or "sudo" group for this to work. If not, switch to a user that is with "su -l <username>" (lower-case "L") first.

Instead of direct command-line usage for copying files and changing permissions, you can use a text-mode file manager like Midnight Commander (inspired by the old Norton Commander). On Ubuntu/Debian derivatives the package to install is "mc" which is also the name of the command used to launch it.

Note that if you are using it in a terminal window, the function keys F1-F10 may be intercepted by the terminal program. Most terminal programs have an option to disable their use of function and other keyboard shortcuts. MC also supports substitute keyboard shortcuts for function keys. Just press <ESC>, # (ESCape followed by a digit) where # is 1-9,0 for F1-F9, or F10.

The keys for changing file ownership in MC is <Ctrl>-x, O (Control-x followed by the letter "O") and for permissions use <Ctrl>-x, c. Use <Alt>-c to type in a directory path to browse to.

About Me

Omnifarious Implementer = I do just about everything. With my usual occupations this means anything an electrical engineer does not feel like doing including PCB design, electronic troubleshooting and repair, part sourcing, inventory control, enclosure machining, label design, PC support, network administration, plant maintenance, janitorial, etc. Non-occupational includes residential plumbing, heating, electrical, farming, automotive and small engine repair. There is plenty more but you get the idea.