Mutt tutorial part 4 - html mails, address book and other useful features

How mutt can handle mails in html format ? Takling about html mail handling is talking about handling any type of Multipurpose Internet Mail Extensions. Mutt supports handling for all MIME types in one place for all programs. This place is .mailcap file. Googling a little bit I found below mailcap file configuration (kudos to Bart Nagel).

1
2
3
4
text/html; pandoc -f html -t markdown; copiousoutput; description=HTML Text; test=type pandoc >/dev/null
text/html;lynx -stdin -dump -force\_html -width 70; copiousoutput; description=HTML Text; test=type lynx >/dev/null
text/html; w3m -dump -T text/html -cols 70; copiousoutput; description=HTML Text; test=type w3m >/dev/null
text/html; html2text -width 70; copiousoutput; description=HTML Text; test=type html2text >/dev/null

Of course we need to install all applications to make mailcap work correct:

1
sudo apt-get install pandoc lynx w3m html2text

To bring address book functionality to mutt we need abook application:

1
sudo apt-get install abook

Also few new line in $HOME/.muttrc will be needed:

1
2
3
4
5
6
# add alias file for addresses
set alias_file=~/.mutt/alias source ~/.mutt/alias
# configure addressbook
set query_command= "abook --mutt-query '%s'"
macro index,pager A "<pipe-message>
abook --add-email-quiet<return>" "add the sender address to abook"

Adding new address simply create entry in alias file. During adding new alias abook asks about alias name, e-mail address, personal name and confirmation for given data. Some this fields could be filled automatically by interaction between abook and mutt. Of course file $HOME/.mutt/alias have to exist before running mutt: touch $HOME/.mutt/alias To access saved aliases simply click button in cc, to or bcc filed. There is few more options that I found useful. To find it please go to my workspace scripts at github. Also if you have any issues with the configuration or comments please let me know by commenting below the post.


Piotr Król
Founder of 3mdeb, a passionate advocate for open-source firmware solutions, driven by a belief in transparency, innovation, and trustworthiness. Every day is a new opportunity to embody the company's vision, emphasizing user liberty, simplicity, and privacy. Beyond business, a casual chess and bridge player, finding peace in nature and nourishment in theology, philosophy, and psychology. A person striving to foster a healthy community, grounded in collaboration and shared growth, while nurturing a lifelong curiosity and a desire to deeply understand the world.