User Tools

Site Tools


email:mutt

Mutt

In my point of view, mutt is one of the best email clients ever, maybe only superseeded by muttng.

Shortcuts

command description
Folder Commands
c=NameReturn changes to a subfolder
c!Return changes to the Inbox
c<Return changes to the Sent Folder
c?Tab or cTabTab shows the mailboxes
Movement Commands
* goto last entry
= goto first entry

Aliases

Aliases are a very handy thing, and of course mutt also has support for them:

set alias_file="/.mutt/aliases"

the aliases file looks like this:

alias me My Self <myself@dom.tld>
alias you Your Self <y.self@ain.tld>
alias we Both of Us <y.self@ain.tld>,<myself@dom.tld>
...

In fact, the last shown entry can be improved, as mutt does recursive alias lookups:

...
alias we you,me
...

which will be transformed into:

Your Self <y.self@ain.tld>, My Self <myself@dom.tld>

so the result is slightly different, but not necessarily worse.

To define a new alias at runtime, use:

a

Config Vars

variable meaning default
spoolfile “Inbox” $MAIL
record “Sent Folder” None
from From: adress of the header None
use_from activates the from-variable yes
envelope_from_address envelope adress None
use_envelope_from activates the envelope_from_address-variable no
sort how to sort messages date

Config Commands

Command arguments meaning
mailboxes folder names, separator=' ' list of mailboxes to be checked for new mail
unmailboxes folder name or '*' deletes folders from the list, or all('*')
save-hook [!]<expr> <destination> sets the default destination for the s-command, <Expr> is an email addy

Misc Tips

Some things i found out at daily usage of mutt

saving many mails into a subfolder

  • first sort them (this one is by subject):
os
  • then set the save-hook (this is for all addresses, save them into the INBOX subfolder fh.ufo):
:save-hook .* =fh.ufo
  • then do at every message:
sReturnReturn
  • finally remove the save-hook again
:unhook save-hook
  • job finished

Fscking GMX With Mutt

GMX does ugly things with the email header to test whether the mail is spam or not.

To be able to use oneself's private internet mailhost for sending mails, the following has to be done to prevent GMX marking one's mails as being spam:

set envelope_from=yes
set envelope_from_address="realuser@realdomain.tld"

important here is that the given email addy really exists. Having these two lines set inside the muttrc, GMX even accepts spoofed addresses in the From: field of the header.

Supporting ''traditional'' PGP-Messages

Some braindead windows-like mail clients use the traditional (inline) method to encrypt/sign mails. Out of the box mutt does not provide support for them, but it can be activated as follows:

At runtime, when displaying an encrypted mail that was not recognized, rescanning the mail body for traditional pgp can be triggered using:

<ESC>P

To enable this feature statically, add the following line to your .muttrc:

set pgp_auto_decode=yes

Fast Spam Processing

I collect spam in a maildir called =.spam for occasionally feeding my SpamAssassin. As I recognise most spam just by viewing at the subject line, I want a short way to move it into the spam folder and removing the New flag of the mail at the same time. This is the macro I defined for that:

macro index S "\Ct*\nt;wO;s=.spam/\ny"

if not using ask_yes when saving mails, the final y can be omitted

Perfect Thread Sorting

The effect of using

set sort=threads

is not perfect. But it can be improved:

set strict_threads=yes

using strict_threads, equal subject lines are ignored for the decision wheter to link a given message to a thread. This is mostly helpful for non-mailinglist mailfolders.

Handling MIME types using mailcap

Certain attachments' MIME type is not defined as precise as one would want them to. A simple example is PDFs which are being labeled application/octet-stream. To allow a finer granularity when choosing an appropriate viewer, mutt supports additional searching for MIME types based on the filename. Using the following line:

mime_lookup application/octet-stream

enables additional searching for a better fitting MIME type inside /etc/mime.types or your local $HOME/.mime.types.

A reasonable entry for files ending with .pdf in /etc/mime.types would be:

application/pdf    pdf

to actually make use of this assignment, mutt supports mailcap definition files. My entries for the above defined MIME type in my local $HOME/.mailcap file are the following:

application/pdf; (cp %s %s-sav \; xpdf %s-sav && rm %s-sav & sleep 1); test=test "$DISPLAY" != ""
application/pdf; pdftotext %s; copiousoutput

so when a $DISPLAY is present, the file is being opened using xpdf. Else pdftotext is being run on the file so it's content can be viewed using e.g. less. Note the following:

  • The %s parameter is already escaped using single quotes.
  • The hack around the call to xpdf allows for running in the background, so the calling mutt instance is still usable while xpdf is running. It seems like mutt doesn't like the program exitting immediately, throwing an error message.

Handling Duplicate Mails

When doing pattern-based stuff (like tag-pattern or delete-pattern) mutt knows a pattern describing duplicates: ~=. So to tag all duplicates in the current mail folder, type: T~= and you're done.

Automatic Spell Check

With vim as editor, one can easily enable spell checking when writing emails like so:

set editor="vim -c 'set spell spelllang=de,en'"
email/mutt.txt · Last modified: 2015/05/03 15:12 by 127.0.0.1