|
|
From my experience the above quote from Michael Elkins (the author of mutt) is totally true. Except for one minor note: most email clients suck ultimately because the final configured product (the email client) sucks. The configuration and setup might be easy, but the more you start using it the more it sucks. Mutt on the other hand is diametrically different. The configuration sucks horribly, but it gets better once everything is finally setup. Then the more you use it, the less it sucks.
(Updated 10/22/2003) - A HTML version of the .mutt rc has been provided, thanks to Benji Fisher <benji_at_member_dot_AMS_dot_org>
postponed and mailboxes fields should be
self-explanatory. We'll make procmail shove your mail into specified
mailboxes later, so don't worry so soon about what belongs in the
mailboxes fields. Again replace my stuff with your
corresponding info. Pick your favorite text editor for
editor.
set realname="tchow"
set folder="~/muttmail" # where my mailboxes are
set postponed="~/muttmail/postponed" # where postponed stuff goes
set mbox=+mbox # mail from spool gets copied in here
mailboxes /var/spool/mail/kodiak # my mailboxes filtered by procmail
mailboxes /home/kodiak/muttmail/lug
mailboxes /home/kodiak/muttmail/admin-lug
mailboxes /home/kodiak/muttmail/bruinlinux
mailboxes /home/kodiak/muttmail/bugtraq
#sent mail should not be defined as a mailbox
#mailboxes /home/kodiak/muttmail/sent
set editor=jmacs # yay! emacs key bindings
The following will copy all your sent mail to your mailbox sent. Call
it whatever you want. "+" expands to what you
specified in folder kind of like how "~" expands in
shells. In this case it would be ~/muttmail/sent.
set copy=yes # + is a mailbox shortcut.
set record=+sent # it expands to whatever you set in folder
hdr_order Date: From: Organization: User-Agent: X-Mailer To: Cc:\
Reply-To: Subject:
ignore *
unignore Date: From: Organization: User-Agent: X-Mailer To: Cc:\
Reply-To: Subject:
Syntax is kind of complicated here. Read the mutt manual if you're interested. Otherwise just copy the following junk and rest in peace. Format for folders, dates, indices, and forwards:
set date_format="!%a, %b %d, %Y at %I:%M:%S%p %Z
set folder_format="%N %-8.8u %8s %d %N %f
set forward_format="Fwd: %s"
folder-hook . 'set index_format="%4C %Z %{%b %d} %-15.15F (%4l) %s"'
Useful aesthetic stuff.
set edit_headers # i like to see the headers when composing email
set pager_context=1 # paging shows me one line leftover
set pager_stop # prevent pager from going to next message unlesss you say so
set nomarkers # no wrap around markers
For those of you who are familiar with hooks in Emacs, mutt has
something similar. The term folder is quasi-synonymous with
mailbox. The "." following folder_hook is a glob for
all folders. (Its a regular expression) I've set it so that all
mailboxes by default are sorted by threads and whenever I'm
reading mail, 10 (yes, 10) messages are shown in a mini-index. Mutt
defaults to not having a mini-index, but I like seeing some
context of messages around the current message I'm reading. However, for
my sent mailbox and spool, I like those to be sorted by date. The
last lines override my default.
folder-hook . set sort=threads
folder-hook . set pager_index_lines=11
#these don't get sorted by threads
folder-hook /var/spool/mail/kodiak set sort=date-received
folder-hook +mbox set sort=date-received
folder-hook +sent set sort=date-sent
unset mark_old # unread old messages are still unread after quitting
set auto_tag # when tagged, actions for messages are default for all tagged messages
set quit=ask-no # ask me to quit. default no
unset confirmappend # don't ask me about appending messages to other boxes
set alias_file="~/.alias_mutt"
source ~/.alias_mutt
The syntax of the alias file is simple. You can have many more aliases
and, you can alias several people to one alias. Here are is a short example:
alias tchow kodiak@linux.ucla.edu (Terry Chow)
alias lug linux@linux.ucla.edu (UCLALUG)
If this is set up correctly, then simply enter the alias whenever prompted
for an email address and mutt will take care of the rest.
bind
command, followed by where your key binding will apply, followed
by which key, followed by a function. Not everything in mutt has
a function so sometimes macros are defined to do something you
would normally do with several keystrokes. I won't delve into macros
here. These are the
ones I have changed/added to the mutt default key bindings. They
are derived from Emacs and slrn key bindings.
bind generic "#" tag-entry
bind generic <left> previous-entry
bind generic <right> next-entry
bind index "c" copy-message
bind index "\Cx\Cf" change-folder
bind pager "c" copy-message
bind pager "#" tag-message
bind pager <up> previous-line
bind pager <down> next-line
bind pager "<" top
bind pager ">" bottom
bind pager <home> top
bind pager <end> bottom
bind pager "{" previous-thread
bind pager "}" next-thread
bind pager "\Cx\Cf" change-folder
bind browser "e" check-new
macro index "\Cx\Cb" "<change-folder>?"
macro index "w" "<change-folder>?"
macro index "\Cx\Cs" "|cat > ~/"
macro pager "\Cx\Cb" "<change-folder>?"
macro pager "w" "<change-folder>?"
macro pager "\Cx\Cs" "|cat > ~/"
export
COLORFGBG="default;default"
The first field is the command color. Second field is
the object you want to alter in mutt. The third and fourth field
specify the foreground and background color. If there is a fifth
field, its the regular expression you want your colors to apply to.
Change default to another color if you want another background
color. Color values can be preceded by "bright" resulting in bold,
bright text. Consult the mutt manual for more info.
color normal default default
color hdrdefault brightcyan default
color signature green default
color attachment brightyellow default
color indicator brightblack brightcyan
color quoted green default
color quoted1 white default
color tilde blue default
This will catch email address and URLs and make them bold and a
different color.
color body brightcyan default "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\.[-a-z][-a-z]+"
color body brightwhite default "(http|ftp|news|telnet|finger)://[^ \">\t\r\n]*"
color body brightwhite default "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+"
This will change the Date: and Subject: fields in headers to
bold yellow or magenta.
color header brightmagenta default ^(Date):
color header brightyellow default ^Subject:
This will make smileys, :) , appear bold.
color body brightred default " [;:]-*[)>(<|]" # :-) etc...
Step 1
Edit or create a .forward file. Put this in and replace "kodiak" with
your user name. Include the quotes.
"|IFS=' ' && exec /usr/bin/procmail -f- || exit 75 #kodiak"
Step 2
LINEBUF=4096
VERBOSE=off
MAILDIR=$HOME/muttmail
FORMAIL=/usr/bin/formail
SENDMAIL=/usr/sbin/sendmail
PMDIR=$HOME/.procmail
LOGFILE=$PMDIR/log
INCLUDERC=$PMDIR/rc.maillists
.procmailrc can be a whole lot more complicated, but the above will
work for basic purposes. Do a whereis formail and
whereis sendmail for the proper paths to them. Do
not use ~ to expand to your home directory. The value for
LOGFILE will be where procmail errors go.
rc.maillists is the file that separates your mail
into folders.
Step 3
Create or edit .procmail/rc.maillists. Here is a working
example:
:0:
* ^TOlinux@linux.ucla.edu
lug
:0:
* ^TObruinlinux@linux.ucla.edu
bruinlinux
:0:
* ^FROMsaa@support.ucla.edu
/dev/null
:0:
* ^FROMchancellor@ucla.edu
/dev/null
Notice that "0" is a zero, not an "oh". Don't ask me about the
strange syntax. I don't know why its like that, but I can tell
you what the parts mean.
But what does all this garbage mean?
:0 means to start a recipe. You can have different
recipes to do different things to certain emails. The following
: means to lock the file. It might be disastrous
if multiple processes are attempting to write to the same file.
The * means to start a condition. A recipe can have
several conditions, but my examples only have one. Following the
* is a regular expression which matches the mail
that you want to filter somewhere. In the first recipe
* ^TOlinux@linux.ucla.edu essentially means all
mail with header "To: linux@linux.ucla.edu". The ^
is standard for regular expression to mean "beginning with". All of the email
from the
UCLALUG discussion mailing list are addressed "To:
linux@linux.ucla.edu".
Note: Use ^TO and not "to:" or something else.
^TO is not a normal regular expression. It is
built into procmail and actually stands for some crazy regular
expression to match all cases of "to", like To:, to:, TO:, to,
To, etc.
The last line in the first recipe, lug, is the mailbox
that you want procmail to send your mail. It can be
an absolute or relative path, but it is relative
to $MAILDIR which you defined in .procmailrc. I
throw my mail from the UCLALUG into mailbox lug.
A procmail recipe is very similar to a if statement for C, C++ or
various other programming languages. For example, the first
recipe is "if mail header is To:
linux@linux.ucla.edu, then send it into the
lug mailbox".
The second recipe is similar to the first one except for a different
mailing list.
The third and fourth recipes take mail with from
chancellor@ucla.edu and SAA and sends them straight to
the garbage. These two never have anything important to say and often
spam me. The condition uses a procmail builtin shortcut,
FROM which stands for a regular expression for many
cases of "FROM:".
Step 4: Finishing up with procmail
By now you should have procmail filtering your email into the proper
mailboxes. I've only touched briefly on the capabilities of
procmail. It can be configured for all sorts of crazy stuff like
automatically replying to some mail or automatically compressing
it and forwarding it somewhere else. The possibilities are
endless.
The index
Use the arrow keys to move around and select the messages. Press
ENTER to read a message.
The pager
Then use
PgUp or PgDn ,the arrow keys or
SPACE to
scroll the message.
If you used my mutt configurations you should be able to see a
mini-index of the messages. Use RIGHT and LEFT
to go forward and backward in the index. If
you didn't use my configuration, push i to go back
to the index and use UP and DOWN for
the next or previous message.
Composing new mail or replying
When you are viewing a message in the index or the pager you can press
r to reply. Also in the index or pager, press
m to compose a new message.
If you reply or start a new message, your editor should come up.
After finishing your message, save and exit the editor and you
will return back to the mutt composition screen. Press
y to send the mail.
The help menu
Remember, press ? for a help menu, describing the default keybindings.
man procmail
man procmailrc
man procmailex
This guide only scratches the surface for mutt and procmail. You can find many more advanced uses from the procmail man pages and the mutt webpage.
/guides/mailguide.php3 last updated on Wed Oct 22 2003