Midnight-Commander as console .eml and .mbox email-file-viewer
This short note explains how to configure the GNU-Midnight-Commander
to view .eml
and .mbox
email-files saved by Thunderbird or Evolution.
Installation
-
Install helper applications
sudo apt install mutt lynx
-
Configure GNU-Midnight-Commander
a. Keep a backup.
sudo cp /etc/mc/mc.ext /etc/mc/mc.ext.orig
b. Open the file
/etc/mc/mc.ext
with your favorite editor.sudo vi /etc/mc/mc.ext
c. Search for:
default/* Open= View=
d. Replace the above with:
shell/i/.eml Open=echo "From - Thu Sep 5 08:43:40 2013" > ~/tmp.mbox && cat %f >> ~/tmp.mbox && mutt -e "alternative_order text/plain text/html" -e "auto_view text/html" -e "set folder=~" -f ~/tmp.mbox && rm ~/tmp.mbox View=echo "From - Thu Sep 5 08:43:40 2013" > ~/tmp.mbox && cat %f >> ~/tmp.mbox && mutt -e "alternative_order text/plain text/html" -e "auto_view text/html" -e "set folder=~" -f ~/tmp.mbox && rm ~/tmp.mbox shell/i/.mbox Open=mutt -e "alternative_order text/plain text/html" -e "auto_view text/html" -e "set folder=~" -f %b.mbox View=mutt -e "alternative_order text/plain text/html" -e "auto_view text/html" -e "set folder=~" -f %b.mbox default/* Open= View=
Test and usage
-
Save an
.eml
file on disk. -
Open the GNU-midnight-commander.
mc
-
Browse to the location of the file and select it.
-
Open the viewer with [F3],[Enter] or [Enter],[Enter].
The later starts mutt to view the content of your email file. HTML will be shown as ASCII with your default text browser.