Mutt E-Mail Client
Mutt is a low resource, highly configurable command line e-mail client. Mutt itself is just a program for reading email. Combined with a text editor, POP/IMAP mail fetcher, and MTA, Mutt becomes a full fledged e-mail client.
Mutt is available in the Debian repositories;
# aptitude install mutt
to install it. If you find a bug, please report it: How to report a bug.
Mutt's configuration is controlled from .muttrc in a user's $HOME directory.
The beginning of .muttrc should look something like this:
set mbox_type=maildir set mbox="~/mail/inbox/" set spoolfile="~/mail/inbox/" set folder="~/mail/" set record="~/mail/sent/" set postponed="~/mail/postponed/"
set mbox_type=Maildir set spoolfile="~/Maildir/" set folder="~/Maildir/" set mask="!^\\.[^.]" set record="+.Sent" set postponed="+.Drafts" mailboxes ! + `\ for file in ~/Maildir/.*; do \ box=$(basename "$file"); \ if [ ! "$box" = '.' -a ! "$box" = '..' -a ! "$box" = '.customflags' \ -a ! "$box" = '.subscriptions' ]; then \ echo -n "\"+$box\" "; \ fi; \ done` macro index c "<change-folder>?<toggle-mailboxes>" "open a different folder" macro pager c "<change-folder>?<toggle-mailboxes>" "open a different folder"
This will tell Mutt a lot about how you handle your mail, and where to look for new mail.
# Automatically log in to this mailbox at startup set spoolfile="imaps://user:pass@domain/" set folder="imaps://user:pass@domain/" set record="=Sent" set postponed="=Drafts" # activate TLS if available on the server set ssl_starttls=yes # always use SSL when connecting to a server set ssl_force_tls=yes # wait to enter mailbox manually set imap_passive # Automatically poll subscribed mailboxes for new mail (new in 1.5.11) set imap_check_subscribed # Reduce polling frequency to a sane level set mail_check=60 # And poll the current mailbox more often (not needed with IDLE in post 1.5.11) set timeout=10 # keep a cache of headers for faster loading (1.5.9+?) set header_cache=~/.hcache # Display download progress every 5K set net_inc=5
This configuration is tested on Debian server running Exim and courier IMAP server.
Other random options
If you want Vim like mail reading, you would want to add this in .muttrc:
# Vim like keybinds bind pager j next-line bind pager k previous-line
# Unset Marking Mails Old unset mark_old # Cancel a message when subject is blank set abort_nosubject=yes # Set default editor set editor="nano" # Asks to include message when replying set include=ask-yes # Asks to postpone a message when not sent set postpone=ask-yes # Ask before printing set print=ask-yes # Delete messages without asking when Mutt is quit set delete=yes # Add an item for each mailbox mailboxes ~/mail/debian-user # Show only important fields in the header ignore * unignore from resent-from reply-to x-mailer user-agent date to cc subject # mail send options set sendmail="/usr/sbin/ssmtp" # Order for display of the header fields hdr_order From: Resent-From: Reply-To: X-Mailer: User-Agent: Date: To: Cc: Subject: # sort messages by thread set sort=threads # Set quotemark to 1 byte set indent_str="> " # Only show the body when I edit a message unset edit_headers # set up mutt so i can run fetchmail at any time by pressing G macro index G "!fetchmail\n" "Invoke fetchmail" macro pager G "!fetchmail\n" "Invoke fetchmail" # tell mutt about my mailing lists subscribe debian-user # set from to ensure mutt doesn't put email@example.com set from="firstname.lastname@example.org" set use_from=yes set envelope_from="yes" # set realname set realname="Joe Avg. User" # set some coloring for easier mail reading # Color messages color index brightyellow default ~N color index brightred default ~D # Collapse old messages set collapse_unread=no folder-hook . 'push <collapse-all>'
Sending E-Mail with Mutt
Note: This is no longer needed since Mutt 1.5.15, which now has its own SMTP system. To make use of this, you must put this in your ~/.muttrc:
# Set smtp url set smtp_url="smtp://email@example.com[:port]"
If you want SSL encryption put smtps:// instead of smtp:// in the above example.
Remote SMTP server example:
set smtp_url = "smtp://firstname.lastname@example.org:25" # ESMTP with TLS set smtp_pass="pass" set from="user@domain" set realname="username"
Note: you may need to change record and postponed based on the server. Check nixtricks at wordpress for details.
set record="=INBOX.Sent Messages" set postponed="=INBOX.Drafts"
Using abook with Mutt
Every good MUA has an address book for storing names, numbers, and email addresses, right? Well so does Mutt! You just have to know how to set it up.
First, you'll need abook.
apt-get install abook
Run abook from a terminal and learn the program, it's very simple. Add a new contact (foobar and email@example.com if you have no ideas), so we can test Mutt with it.
Next, you'll need to edit your muttrc file to be able to query your address book. Add this into your .muttrc file:
# Use abook with Mutt set query_command="abook --mutt-query '%s'" macro index a "|abook --add-email\n" 'add sender to abook' macro pager a "|abook --add-email\n" 'add sender to abook'
Run Mutt, and type a capital Q at the pager. Type in foo (Or the first name of the person you added into your abook), and a list should appear with anybody from your abook matching the query. If you select any of them with the enter key, it automatically starts writing a mail to that person! Now you have Mutt with an address book, sleek eh?
Don't you hate having to copy and paste links out of xterm just to view them? Or how about when you're running outside of a X session? This is an easy way to set Mutt up so that you can view URLs without too much hassle, and come back into Mutt when you're done reading the page.
You'll need another package for this one.
apt-get install urlview
And add these lines into your .muttrc file:
# View URLs inside Mutt macro index \cb "|urlview\n" macro pager \cb "|urlview\n"
Now inside of Mutt, find a mail with a URL in it, and hit Ctrl+B. Click any of the choices that come up, and it will open in a new browser window, which makes viewing URLs ten times easier.