Calmar on Mutt (for dummies or however)
- Mutt, the e-Mail Client's Homepage
- Mutt's Manual-Site (there especially '2. Getting Started' and '4. Advanced Usage' for actually 'driving' mutt
- Pressing F1 in mutt may provides a manual too
- mutt FAQ
Section 1 - Settings basically
Who you are (settings)
you need to tell mutt who are (in e.g. ~/.mutt/muttrc)
unmy_hdr * # delete existing header-settings, if there are any. my_hdr X-Homepage: http://www.calmar.ws my_hdr X-PGP-Key: http://www.calmar.ws/calmar.asc set from="email@example.com" set realname="calmar" set signature='~/.signature'
The set from="..." is needed, because that variable needs mutt to identify 'who' you are actually. (E.g. on the $index_format with switches like %F showing you the To: instead of the From: (messages sent out by you)).
May have a read here first of all: Mutt Folder Wiki
My folder-configuration parts in my muttrc config file
set folder=~/.mail # there are the mailboxes (+ / = are shortcuts for it now) set mbox_type=mbox # see the wiki, there are 4 to choose from. # mbox is here a way 'how' to store mails. Below is mbox meant # as a 'mailbox' where read mails are saved ouf of the # inbox ($spoolfile). set spoolfile=+inbox # incoming mails (~/.mail/inbox) set move=yes # yes (move read mails automatically to $mbox) set keep_flagged=yes # esc-f to mark message in spool, and it won't move to $mbox) set mbox=+read_inbox # ~/.mail/read_inbox set postponed=+postponed # an 'internal' box for mutt basically set record="+Sent-`date +%Y`" # sent messages goes there (e.g. $folder/Sent-2006) set header_cache=~/.mail/mutt_cache/ # a much faster opening of mailboxes...
Mutt shows mails in the spoolfile (~/.mail/inbox in my case) on startup. After reading them, they move to the $mbox (~/.mail/read_inbox in my case (on leaving the $spoolfile box so). The mail moves to mbox because I set the variable 'move=yes'.
NOTE: If you want that each incoming mail stays in the inbox, check out move=no. I used that setup for quite some time. Since the inbox gets very large (and slower to open, as an big disadvantage), I emptied it every few month, with moving the contents to a backup box like inbox_2007 (e.g. mark all T.* and save (same as append in mutt) all tagged ;s to inbox-archive-2007): T.*;s+inbox-archive-2007. Anyway, since it's a fast switch to the $mbox (e.g. c><ret>) I use move=yes actually with all it's advantages. But may test it yourself what you prefer. (You should have keep_flagged=yes as well, then you mark messages you want to stay in the inbox (spool) via esc-f and they stay there until unflagged (esc-f again).
Mailboxes: you can have special boxes in mutt with 2 additionaly features compared to 'normal' boxes/folder:
- mutt will check them for new mails, mark them with an 'N', and notify you in the status line. E.g: =inbox[Msgs:56 New:1 Box-new:1] means: you're actually in the inbox with 56 Messages inside, where 4 are not yet read. Additionally it notifies you (Box-new:1), that there is 1 of your mailboxes with at least one new mail for you to read.
- You have on such defined 'mailboxes' also a special nice overview. You can switch between the mailboxes-view and browser ('normal' file-system view) with <tab>
You can define these mentioned 'mailboxes' above like that:
mailboxes =inbox mailboxes =mbox mailboxes =calmar mailboxes =mail-daemon
You can set, how often mutt shall check for new mails with:
set timeout=10 # mutt 'presses' (like) a key for you (while you're idle) # each x sec to trigger the thing below set mail_check=5 # mutt checks for new mails on every keystroke # but not more often then once in 5 seconds set beep_new # beep on new messages in the mailboxes
May also have a look for these two variables above at the FAQ or manual (e.g. press F1 in mutt)
There are various addressbooks. I use mutt-aliases and abook with these settings:
set alias_file=~/.mutt/aliases # aliases-file is there source ~/.mutt/aliases # and include all existing aliases set query_command="abook --mutt-query '%s'" # address book macro editor ";" \Ct # bin ; to Ctrl-t in editor-mode (easier IMO)
So, when I store a new mail-address with `a' on a message, it will get written into the alias file. I can access the alias file after a m (for writing a new message) with <tab>. Additionally, I move them from time to time to my 'real' addressbook program 'abook' (there: ic/home/calmar/.mutt/aliases (see also ? for help)) to import it. After importing you may want to empty the aliases file (e.g. echo > ~/.mutt/aliases)
Anyway, in the alias file I often keep temporarly addresses, I don't want in the abook. So before importing the mutt aliases file into abook, I first remove the outdated entries in the alias file (possible with a text-editor).
Now when I enter a email (after e.g. a `m') I can type some pattern of a specific address, then press Ctrl-T (or just ; with my 'lazy/efficient' macro above) and when there is only one match in abook, there you go... When there are more matches, you can select them out of a list. The pattern will try to match on the name and/or the email-address.
For your convenience you can set many other settings in your muttrc.
Section 2 - How to use it actually
Keep important messages in the inbox/"mind" until they are 'done'
With the esc-f you can mark them as important. When the settings 'set move=yes' and 'set keep_flagged=yes' it will keep them in the inbox, while the rest goes away into the 'set mbox=+read_inbox'
How to switch between boxes:
How to switch to the mailboxes-list (defined as such in muttrc):
- c<tab><tab> (sometimes more then two <tab>'s necessary)
Additionally there are some very useful shortcuts:
|!||$inbox||~/.mail/inbox (in my case)|
|>||$mbox||`~/.mail/read_inbox' in my case|
|<||$record||+Sent-`date +%Y` (actually ~/.mail/Sent-2007)|
|- or !!||last visited box|
|+ or =||$folder||~/.mail/ (in my case)|
|^||current folder/box||e.g. to update a box when externally changed|
So you can change to the inbox with c!<ret>. Or to the sent messages with c<<ret>.
BTW: When there is a new mail in one of the 'mailboxes' (definded as such), and you press c for switching boxes, a 'mailbox' with new messages will be there pre-'entered' for your convenience. So may use a simple c<ret> to change to the new message(s) in those mailboxe(s).
How to switch to the file-browser:
- c<tab> (sometimes more then one <tab> needed)
Once you're there, you can navigate in the same way you can do in the index. With j, k, z, Z, number, ...).
When you're going to change a folder with c, you can use tab-completion. E.g.: c=inb<tab> expanding to =inbox ('=' representing the $folder (in my case ~/.mail)).
Postponing (drafts or similar):
Let's say, you're not yet finished with a mail for some reason you're just writing on and you want to temporarly store it for a quick-recall later. You can do that with leaving the editor (internal, vim, ..) and then press P in the compose screen.
The message will dissapear and you will be in the box you begun writing you mail previously. You can now, at any time, in this or also while you're in another box, just press R, and woop, you're in the editor again at your previously postponed message. In the case there are more than one postponed messages, mutt offers them for selecting.
How to search for messages
May have a look at Mutt search patterns Manual page. May carefully read it. It's not long and searching is important quite often, isn't it. May look up the examples below in the manuel if something is unclear.
If you don't enter any search-keys, you will search for what $simple_search is defined (Default: ~f %s | ~s %s). So that means you get messages that match your pattern (regex here) in the 'From:' header (who sent you that?) or on the 'Subject:'. That's about what you see (on default settings at least) in the index-view.
Some search Examples (/ for triggering the search):
The first column is the search, the second what you can remember/are searching for:
|~b word ~d <2w||'word' in the body, and the message is not older then 2 weeks|
|~f link ~b mathis||part of the email matches a 'link' regex (e.g: From: firstname.lastname@example.org) and in the body text, there was a 'mathis' regex found - a name actually.|
|~d 01/01/2013-31/06/2013||Mails on between those dates|
|~F ~f link ~b mathis||When you want to search for tagged (with F) messages and having the regex 'link' in the From: Header and 'mathis' in the body, you will see a big difference in the search speed, if you use ~F ~f link ~b mathis or ~b mathis ~f link ~F. So use 'cheap' things like 'is the message tagged or not (~F)' at the begin. ~f is also cheap because it only has to check lines beginning with From: first of all, and on those finally 'mathis' in the body. ~b at the begin is very 'expensive' because mutt actually digs through the whole messages for finding that pattern as first action. Using the = instad of ~ might is faster, but see below about 'case sensitivity'.|
|~f link =b mathis||That will find ('=' for exact words, '~' for regular expressions) for exact words like 'mathis' in the body. It does not match 'Mathis' nor MATHIS. It's 'case sensitive'. Would you use ~b mathis, is matches also 'Mathis' and MATHIS (no kapitals in ~ key for 'case insensitive'). If you use ~b Mathis, it again only matches 'Mathis', because when there is a kapital letter in the regex, mutt tries to match 'case sensitive' as well. Conclusion: use ~ and only lower-case letters when you want a case-insensitive search.|
|~f gart ! ~f css||Find messages with gart in the From: header, but not css.|
Very fast multi-box searching with (but won't work with mbox format)not-much
Very fast multi-box searching with mairix
Create an according .mairixrc file for your needs and (re)initialize your database with: mairix -v
See man mairix for possible search options (like t: s: b: etc). A simple example: mairix "f:mathis d:3w-", delivers me all mails with the word 'mathis' in the From: header, not older than 3 weeks, into the mfolder (~/.mail/mfolder in my case). So I can open that folder with mutt -f ~/.mail/mfolder 'et voila'.
You can execute that also within mutt after typing `!'.
Some other tips
powerpoint viewer 97 and mutt
In order to open .pps files. you may need to install wine and the powerpoint-viewer 97 (I never checkout out the ppsview 2003). They probably also open with openoffice or however, but I use the setup here described.
Then I have a little script like the one below, placed within the path anywhere (~/bin in my case). I named it ppsmutt:
#!/bin/bash wine "/home/calmar/.wine/fake/Program Files/PowerPoint Viewer/PPVIEW32.EXE" "Z:$1"
That calls the viewer with an argument like "Z:/tmp/file.pps", what seems to work here. May open the viewer alone, to find out, if Z or whatever is the right path to the /tmp/ folder within that wine-environment.
Then may add an entry into your ~/.mailcap file like:
application/vnd.ms-powerpoint; ppsmutt %s
Here's my personal mailcap file, just in case.
mutt with the mouse (calmar is hiding)
With e.g. Eterm you can setup a button-toolbar like that:
with a theme.cfg file like that (bind and button-part only):
begin actions # bind button1 to echo "\n" bind button2 to echo "\n" bind button3 to echo " " bind button4 to echo "k" bind button5 to echo "j" end begin button_bar button "q " action echo "q" button "| navi: " action echo "" button "j " action echo "j" button "k " action echo "k" ... button "^G " action echo "" button "m " action echo "m" button "h " action echo "h" button " ? " action echo "?" end button_bar