--- xml/htdocs/doc/en/guide-to-mutt.xml 2006/09/17 16:08:36 1.19
+++ xml/htdocs/doc/en/guide-to-mutt.xml 2011/08/17 19:49:12 1.20
@@ -1,259 +1,128 @@
-
+
-
+
-
If you're not a fan of e-mail clients with fancy graphical user interfaces, or
-if you would just like to experiment with other mail clients before deciding
-which is best for you, here is the easy way to begin using these powerful
-command line tools:
-
-fetchmail, procmail, mutt & smtp
-
-These programs are not only powerful and highly customizable but also small and
-efficient. Once you are up and running with this e-mail system you will be
-amazed at what you can do with it.
+you just like to be able to quickly read some mail over an SSH connection, the
+class of console-based mail clients might be for you.
-Because this is a quick start guide, we will eliminate the Mail Transfer Agent
-(MTA) such as sendmail, postfix or exim. This means no complex MTA
-configuration. It also eliminates using port 25 for mail service.
+Mutt is one of the current console-based mail clients that's still under active
+development and has a vast crowd of active supporters (and users). It is
+powerful, highly customisable, small and efficient.
-We can do this because fetchmail can force the mail it retrieves directly to a
-Mail Delivery Agent (MDA) rather than forwarding to port 25. And we don't need
-to use a complex MTA for plain old outgoing mail delivery.
-
-These are the programs you will need to get your e-mail running.
-
-Then just four quick steps to configure files and you will be up and running a
-brand new e-mail system.
+While Mutt was originally designed to read mail from the local mbox mail spool
+(e.g.
-Fetchmail fetches mail from remote servers and forwards it to your local
-machines delivery system. To use it you need to set up a
-
-Once you have created a
-To see fetchmail in action, use the verbose mode (-v). To fetch all messages
-use -a. And you must use the option -m to tell fetchmail to send the mail to
-procmail.
-
-Run it now to see fetchmail in action!
+Starting your Mutt adventure simply requires you to emerge it.
+Unfortunately, Mutt has a lots of options, which enable or disable certain
+functionalities of Mutt. We now briefly discuss the most important USE-flags
+that you may want to enable based on your intended usage of Mutt. Please note
+that enabling most of them won't harm your Mutt, but may make it do more than an
+experienced Mutt user would like.
-Once you have a working mail system you can set this as a cron job or put it in
-a monitor like gkrellm. Fetchmail can also run in a daemon mode for which you
-specify a polling interval in seconds.
+First off, for newcomers, the
-Procmail is the processor that filters the mail that is forwarded to it by
-fetchmail. It also acts as the MDA to deliver mail to your mailboxes where mutt
-(your e-mail client) can read it.
+Often you happen to jump through a couple of messages a couple of times shortly
+after each other, which would require to download the same message over and
+over again. Since this simply is a waste, Mutt uses a so-called header cache
+(hcache) to keep the most important bits of messages that it needs. This
+hcache is backed by a db-library, of which four flavours exist:
-To use procmail you need to create a
-You can now test
-Now that fetchmail and procmail have run, go to
-Mutt is used to read and compose e-mail. It is powerful and highly customizable
-but also small and efficient.
-
-# emerge fetchmail nbsmtp procmail mutt
-
-
-
-poll mail.myisp.net protocol pop3 user "myname" password "mypasswd"
-
-
-
-$ chmod 600 .fetchmailrc
-
-
-
-$ fetchmail -akv -m "/usr/bin/procmail -d %T"
+
+% emerge -pv mutt
+[ebuild N ] mail-client/mutt-1.5.21-r1 USE="gdbm gpg imap mbox nls nntp \
+ sidebar smime smtp ssl -berkdb -crypt -debug -doc -gnutls \
+ -idn -pop -qdbm -sasl -tokyocabinet"
-MAILDIR=$HOME/MuttMail ##you better make sure it exists
-LOGFILE=$HOME/.procmaillog
-LOGABSTRACT=no
-#VERBOSE=on...is only used for debugging
-VERBOSE=off
-FORMAIL=/usr/bin/formail
-NL="
-"
-##recipe lines begin with :0
-##dont put comments on recipe lines
-##disable a recipe with the false condition !
-##condition lines begin with * and regex is your friend
-##conditions are anded and everything after * is fed straight into egrep
-##one action line follows the conditions, in this case it is a mailbox name
-
-#catch duplicates using formail
-:0 Whc: .msgid.lock
-| $FORMAIL -D 16384 .msgid.cache
-
-:0 a
-$MAILDIR/duplicates
-
-#people we always allow mail from
-:0
-* ^From:.*(craig\@hotmail|renee\@local.com)
-$MAILDIR/friends
-
-#now flush some spam out
-:0
-* ^Subject:.*(credit|cash|money|debt|sex|sale|loan)
-$MAILDIR/spam
-
-#no more html messages
-:0
-* ^Content-Type:.*html
-$MAILDIR/junk
-
-#now put my mail lists into mailboxes
-:0
-* ^List-Id:.*gentoo-user
-gentoo-user
-
-:0
-* ^List-Id:.*gentoo-dev
-gentoo-dev
-
-:0
-* ^List-Id:.*gentoo-announce
-gentoo-announce
-
-#catch any other gentoo mail
-:0
-* ^From:.*gentoo.org
-gentoo
-
-:0
-* ^From:.*@freshmeat\.net
-freshmeat
-
-################################
-# Last rule: mail that gets #
-# this far goes in default box #
-################################
-:0
-* .*
-default
-
-# End of file
-
-
-
-$ fetchmail -akv -m "/usr/bin/procmail -d %T"
-
-
+# character set on messages that we send +set send_charset="utf-8" +# if there is no character set given on incoming messages, it is probably windows +set assumed_charset="iso-8859-1" + +# make sure Vim knows mutt is a mail client and that we compose an UTF-8 encoded message +set editor="vim -c 'set syntax=mail ft=mail enc=utf-8'" + +# just scroll one line instead of full page +set menu_scroll=yes + +# we want to see some MIME types inline, see below this code listing for explanation +auto_view application/msword +auto_view application/pdf + +# make default search pattern to search in To, Cc and Subject +set simple_search="~f %s | ~C %s | ~s %s" + +# threading preferences, sort by threads +set sort=threads +set strict_threads=yes + +# show spam score (from SpamAssassin only) when reading a message +spam "X-Spam-Score: ([0-9\\.]+).*" "SA: %1" +set pager_format = " %C - %[%H:%M] %.20v, %s%* %?H? [%H] ?" + +# do not show all headers, just a few +ignore * +unignore From To Cc Bcc Date Subject +# and in this order +unhdr_order * +hdr_order From: To: Cc: Bcc: Date: Subject: + +# brighten up stuff with colours, for more colouring examples see: +# http://aperiodic.net/phil/configs/mutt/colors +color normal white black +color hdrdefault green default +color quoted green default +color quoted1 yellow default +color quoted2 red default +color signature cyan default +color indicator brightyellow red +color error brightred default +color status brightwhite blue +color tree brightmagenta black +color tilde blue default +color attachment brightyellow default +color markers brightred default +color message white black +color search brightwhite magenta +color bold brightyellow default +# if you don't like the black progress bar at the bottom of the screen, +# comment out the following line +color progress white black + +# personality settings +set realname = "Andrew Dalziel" +set from = "andy@mail.server" +alternates "andrew@mail.server|andrew.dalziel@mail.server" +# this file must exist, and contains your signature, comment it out if +# you don't want a signature to be used +set signature = ~/.signature + +# aliases (sort of address book) +source ~/.aliases + +# IMAP connection settings +set mail_check=60 +set imap_keepalive=300 + +# IMAP account settings +set folder=imaps://andy@imap.mail.server/ +set spoolfile=imaps://andy@imap.mail.server/ +set record=imaps://andy@imap.mail.server/Sent +set postponed=imaps://andy@imap.mail.server/Drafts + +# use headercache for IMAP (make sure this is a directory for performance!) +set header_cache=/var/tmp/.mutt + +# mailboxes we want to monitor for new mail +mailboxes "=" +mailboxes "=Lists" --Mutt supports reading and writing of four different mailbox formats: mbox, -MMDF, MH and Maildir. The mailbox type is autodetected. In our case we are -using the mbox format, where all messages of a mailbox are stored in a single -file. -
- --Mutt also has the ability to work with folders located on a remote IMAP server. -See IMAP Support in section 4.11 of the Mutt manual and the Mutt web site -
- -http://www.mutt.org/ --When you emerged mutt in the first step it installed a configuration file in -
- -/etc/mutt/Muttrc . You also need to create a.muttrc -file in your home directory. ---(Be sure to read the fine Mutt manual in /usr/share/doc/mutt*) -(Any settings here override the system settings in /etc/mutt/Muttrc) - -# cp /etc/mutt/Muttrc ~/.muttrc -# nano -w .muttrc -set pager_context=1 -set pager_index_lines=6 #show a mini-index in pager -set menu_scroll -set pgp_verify_sig=no #dont show pgp in pager -set status_on_top #put status line at top -set sort=threads #sort by message threads in index - -set status_format=" %r %b %f %n Del %d Msgs %m %l %> (%P)" -set pager_format="%-10.10i %[!%a %b %d %R]" -set date_format="!%H:%M %a %d %b " -set index_format="%4C %Z %[%b%d] %-15.15F %s" -set folder_format="%2C %t %8s %d %N %f" - -#set sendmail="/usr/bin/nbsmtp -d isp.net -h smtp.isp.net -f yourname@isp.net" - -#set from="default-mailaddress" #set to your from address -#set realname="myname" - -set record="$HOME/MuttMail/sent" #sent mail is saved here -set delete=yes #delete without prompting -set include=yes #quote msg in reply -set fast_reply=yes #no prompting on reply -set beep=no #no noise -set markers=no #no + on wrapped lines -set confirmappend=no #no prompt for save to =keep -set to_chars=" +TCF" #no L for mail_list - -set folder = $HOME/MuttMail -mailboxes =gentoo-user -mailboxes =gentoo-dev -mailboxes =gentoo-announce -mailboxes =gentoo -mailboxes =freshmeat -mailboxes =duplicates -mailboxes =default -mailboxes =friends -mailboxes =junk -mailboxes =spam -mailboxes =keep - -save-hook .* =keep #default mbox to (s)ave mail is =keep -subscribe gentoo-user gentoo-dev #subscribed to these lists - -bind pager h display-toggle-weed #toggle headers with h key - -# simulate the old url menu -macro index \cb |urlview\n 'call urlview to extract URLs out of a message' -macro pager \cb |urlview\n 'call urlview to extract URLs out of a message' - -#run fetchmail by hitting key of G -macro index G "!fetchmail -a -m 'procmail -d %T'\r" -macro pager G "!fetchmail -a -m 'procmail -d %T'\r" - -#use to edit .muttrc and then source it...no restart necessary -macro generic ,sm ":source $HOME/.muttrc\r" -macro generic \cj "!rxvt -bg wheat -e joe $HOME/.muttrc\r" - -# default list of header fields to weed out when displaying mail -#ignore them all and then unignore what you want to see -ignore * -unignore Date To From: Subject X-Mailer Organization User-Agent -hdr_order Date From To Subject X-Mailer User-Agent Organization - -##your Mutt has to have some colors -##these are for four levels of quoted text -##they override the system settings in /etc/mutt/Muttrc - -#color quoted green default -color quoted1 magenta blue -#color quoted2 yellow default -#color quoted3 red default -#color signature cyan cyan - - -#this color setup is copied from /etc/mutt/Muttrc.color -#comment it out if you want the default colors in /etc/mutt/Muttrc -# Je vois la vie en rose :-) -color hdrdefault brightcyan blue -color header brightwhite blue "^from:" -color header brightwhite blue "^subject:" - -color quoted brightgreen blue -color signature brightwhite blue - -color indicator blue green - -color error red black -mono error bold -color status black cyan -mono status bold -color tree yellow blue - -color tilde brightmagenta blue -color body brightwhite blue "[-a-z_0-9.]+@[-a-z_0-9.]+" -mono body bold "[-a-z_0-9.]+@[-a-z_0-9.]+" -color body brightyellow black "^Good signature" -mono body bold "^Good signature" -color body brightwhite red "^Bad signature from.*" -mono body bold "^Bad signature from.*" -color normal white blue -color message green black -color attachment brightgreen blue +# mailing lists we are on (these are regexps!) +subscribe "gentoo-.*@gentoo\\.org" -# End of file...but it can go on and on and on....:) +# SMTP mailing configuration (for sending mail) +set smtp_url=smtp://mail.server/-For the record, this is just a sample
- -.muttrc . There are many more -options that you can configure, such as integration with GPG. Have a look at -http://www.dotfiles.com/index.php?app_id=27 for more examples and -help. --You are now ready to test your
- -.muttrc . --$ mutt -y -- --This should open Mutt with a menu showing the Mutt mailboxes that you created -in Test 2 when you ran the fetchmail command. -
- --Type the ? for help in navigating the Mutt Mailboxes. -
- - - - - -- SMTP -- - - -The final step is setting up nbsmtp the 'No-Brainer SMTP' used to send mail to -your SMTP server. This setup is the easiest of all, as it only requires adding -an entry in your
- -.muttrc file. --domain: The domain you want nbsmtp to say it belongs to. This will almost -invariably be the same as the domain in your e-mail address. -
++It is good practice to review all settings from the example above. There are +many more, and some preferences may actually not match yours. Keep that in mind +when you feel that Mutt at first doesn't really work the way you like. + -from@addr: This is the address you want nbsmtp to say the message is from. Note -that this can be different than the "From:" line in your MUA. +The example
.muttrc above sets up an IMAP account, uses an SMTP +server to send mail, stores its cache in/var/tmp/.mutt , reads the +known address aliases (think of it as an address book) from +~/.aliases and appends the signature from~/.signature +when composing new mail. For some IMAP servers it may be necessary to change the +spool, record and postponed directories, as the foldersSent and +Drafts may be under a folder calledINBOX . Simply +trying this out with Mutt is the simplest way to figure this out.-host: This is the smtp server you are sending to. +Once your
-.muttrc is setup, you are ready to launch Mutt by just +runningmutt . If you entered a valid IMAP server url, Mutt will prompt +you for your password and afterwards load all messages for you. Note that the +first time entering your mailbox may take a while if you have quite some +messages, since Mutt's header cache is still empty. If this succeeds you're in +your IMAP mailbox ready to go.-$ nano -w .muttrc -set sendmail="/usr/bin/nbsmtp -d isp.net -h smtp.isp.net -f urname@isp.net" ---You are now ready to send a message. So in the Mutt pager or index hit the -
m key to compose a test message to send to your e-mail address. Mutt -will use the value of the EDITOR or VISUAL for the composition editor unless -you seteditor= in the.muttrc . When you are done composing -hity to send your message. If there are no errors you will see 'sending -mail' followed by 'Mail sent.' +Navigation is intuitive, as is reading messages by just pressing the enter key +or space bar. Mutt is quite Vim alike in that it uses key strokes to perform +most of its actions. You best read Mutt's manual on the web to get yourself +known with all existing functions (or press ? in Mutt) and what key they are +bound to, or better, what key you like it to be bound to. Some essential keys +arem (for message) to start composing a new message,q for quit, +r for reply,s for save andp for print.-Remember in
.muttrc we have set where to save sent mail with -set record="$HOME/MuttMail/sent" +One of the features that Mutt has that is still not in today's most savvy email +clients is the ability to display attachments inline through some viewer. The +auto_view directive in the .muttrc file tells Mutt which attachments (based on +their MIME-type) it should view inline. To figure out how to do that, Mutt uses +mailcap files to lookup how to display a certain MIME-type. Usually the system +wide mailcap file isn't sufficient here, so you better start a +~/.mailcap file to put items in there forcopiousoutput that +Mutt can display inline.-Now to complete the test, run fetchmail again to get all your mail and verify -you have received the message you sent to your e-mail address. When you find -your test message, hit the
-h key to toggle a view of all the headers and -see the complete mail transfer path. +In the example.muttrc aboveauto_view is enabled for +application/msword andapplication/pdf files. These two show +the extreme usefulness of this capability, because it means meeting notes sent +as doc file now are perfectly fine readable without having to save the +attachment and open it in OpenOffice. Instead the text just shows up in the +message reader, that is, if you have a matching entry in your +~/.mailcap file.-There is one more program you probably want to add called urlview. This -extracts the urls in message texts and sends them to your browser. - - --# emerge urlview ++application/msword; antiword '%s'; copiousoutput; description=Word Document; +nametemplate=%s.doc +application/pdf; pdftotext '%s' -; copiousoutput; description=PDF Document; +nametemplate=%s.pdf-Then create
- -~/.urlview by copying the configuration file from -/usr/share/doc/urlview*/ and setting your browser command. --You now have a powerful and highly customizable mail system. To take advantage -of its flexibility, read all the manuals and docs and find the many user -configuration files available on the web: search for
@@ -506,86 +315,21 @@procmailrc and -muttrc . +The above.mailcap example tells mutt what to do to "view" +msword andantiword (emergeapp-text/antiword ), for the latter the +programpdftotext (emergeapp-text/poppler ). You can go wild with +these to for example display rendered HTML (giveapp-text/vilistextum a +try), render vcards, or show ASCII representation of attached images. All you +need to do is define how to call the program in your.mailcap , and +tell Mutt to try to view it inline using theauto_view directive.- Authenticated SMTP +Conclusions - -Using nbSMTP -If you need to pass a username and password to your SMTP server, you can edit -the
- -set sendmail command in your.muttrc to include-U -<username> -P <password> , like this: --set sendmail="/usr/bin/nbsmtp -U username -P password -d isp.net -h smtp.isp.net -f urname@isp.net" -- --If you do not want this information to be present in your
- -.muttrc -file, you can also create a.nbsmtprc file in which you include all -information: --auth_user = username -auth_pass = password -- - -- Alternative: Using msmtp - - --
- -msmtp is a simple alternative tonbsmtp with similar -possibilities. --# emerge msmtp -- --Now login as a normal user and configure msmtp by creating a -
- -~/.msmtprc file, filling in your SMTP server's information. -Remember to set the permissions to a secure value! --$ nano -w .msmtprc -account default -host smtp.your_provider.net -from your_username@provider1.net -- -#see man page for more auth options -auth login -user your_username -password your_password -#If your SMTP Server supports TLS encryption, uncomment the next line -#tls --Now set the permissions of the file to a secure value: -
- --$ chmod 600 .msmtprc -- --Finally, edit or add the following line to
- -.muttrc --$ nano -w .muttrc -set sendmail="/usr/bin/msmtp" -- --Fire up
mutt and send yourself a test email to see if it worked! See -the msmtp man page for more options and another example. +Mutt is a very versatile console email client. If you like the concept, Mutt +can be altered to behave in nearly any way through its configuration. Search +the web to find others explaining how they did "it", or find one of the many +patches that exist to make Mutt do even more. Gentoo applies a couple of very +popular patches to Mutt, so make sure to checkmutt -v if you want +something more to make sure it is not yet already at your disposal. While +learning Mutt is not necessarily easy, once it is in your fingers, it can make +your mail experience much faster and efficient than with other clients. +Searching for example is quite powerful if you know how to hit the right flags +and know which regular expression narrows your search down. Enjoy Mutting!