https://wiki.archlinux.org/api.php?action=feedcontributions&user=Jumez&feedformat=atomArchWiki - User contributions [en]2024-03-29T15:12:45ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Mutt&diff=274690Mutt2013-09-08T10:34:44Z<p>Jumez: Added "to" in order to make the sentence make more sense.</p>
<hr />
<div>[[Category:Email Client]]<br />
[[es:Mutt]]<br />
[[it:Mutt]]<br />
[[zh-CN:Mutt]]<br />
[[zh-TW:Mutt]]<br />
{{Article summary start}}<br />
{{Article summary text|A guide on configuring and using Mutt.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|fdm}}<br />
{{Article summary wiki|msmtp}}<br />
{{Article summary wiki|offlineimap}}<br />
{{Article summary end}}<br />
<br />
'''Mutt''' is a text-based mail client renowned for its powerful features. Though over a decade old, Mutt remains the mail client of choice for a great number of power-users. Unfortunately, a default Mutt install is plagued by complex keybindings along with a daunting amount of documentation. This guide will help the average user get Mutt up and running, and begin customizing it to their particular needs.<br />
<br />
==Overview==<br />
Mutt focuses primarily on being a Mail User Agent (MUA), and was originally written to view mail. Later implementations added for retrieval, sending, and filtering mail are simplistic compared to other mail applications and, as such, users may wish to use external applications to extend Mutt's capabilities. <br />
<br />
Nevertheless, the Arch Linux {{Pkg|mutt}} package is compiled with IMAP, POP3 and SMTP support, removing the necessity for external applications.<br />
<br />
This article covers using both native IMAP sending and retrieval, and a setup depending on [[OfflineIMAP]] or [[getmail]] (POP3) to retrieve mail, [[procmail]] to filter it in the case of POP3, and [[msmtp]] to send it.<br />
<br />
==Installing==<br />
[[pacman|Install]] {{Pkg|mutt}}, available in the [[Official Repositories]]. <br />
<br />
Optionally install external helper applications for an IMAP setup, such as {{Pkg|offlineimap}} and {{Pkg|msmtp}}.<br />
<br />
Or (if using POP3) {{Pkg|getmail}} or {{Pkg|fdm}} and {{Pkg|procmail}}.<br />
<br />
{{Note|<br />
*If you just need the authentication methods LOGIN and PLAIN, these are satisfied with the dependency {{Pkg|libsasl}}<br />
*If you want to (or have to) use CRAM-MD5, GSSAPI or DIGEST-MD5, install the package {{Pkg|cyrus-sasl-gssapi}}<br />
*If you are using Gmail as your SMTP server, you may need to install the package {{Pkg|cyrus-sasl}}<br />
}}<br />
<br />
==Configuring==<br />
This section covers IMAP, [[#POP3]], [[#Maildir]] and [[#SMTP]] configuration.<br />
<br />
Note that Mutt will recognize two locations for its configuration file; {{ic|~/.muttrc}} and {{ic|~/.mutt/muttrc}}. Either location will work.<br />
You should also know some prerequisite for Mutt configuration. Its syntax is very close to the Bourne Shell. For example, you can get the content of another config file:<br />
source /path/to/other/config/file<br />
You can use variables and assign the result of shell commands to them.<br />
set editor=`echo \$EDITOR`<br />
Here the {{ic|$}} gets escaped so that it does not get substituted by Mutt before being passed to the shell.<br />
Also note the use of the backquotes, as bash syntax {{ic|$(...)}} does not work.<br />
Mutt has a lot of predefined variables, but you can also set your own. User variable '''must begin with "my"!'''<br />
set my_name = "John Doe"<br />
<br />
===IMAP===<br />
''Native and external setups''<br />
<br />
====Using native IMAP support====<br />
The pacman version of Mutt is compiled with IMAP support. At the very least you need to have 4 lines in your muttrc file to be able to access your mail.<br />
<br />
=====imap_user=====<br />
set imap_user=USERNAME<br />
<br />
Continuing with the previous example, remember that Gmail requires your full email address (this is not standard):<br />
set imap_user=your.username@gmail.com<br />
<br />
=====imap_pass=====<br />
If unset, the password will be prompted for.<br />
set imap_pass=SECRET<br />
<br />
=====folder=====<br />
Instead of a local directory which contains all your mail (and directories), use your server (and the highest folder in the hierarchy, if needed).<br />
set folder=imap[s]://imap.server.domain[:port]/[folder/]<br />
<br />
You do not have to use a folder, but it might be convenient if you have all your other folders inside your INBOX, for example. Whatever you set here as your folder can be accessed later in Mutt with just an equal sign (=) or a plus sign (+). Example:<br />
set folder=imaps://imap.gmail.com/<br />
<br />
It should be noted that for several accounts, it is best practice to use different folders -- e.g. for ''account-hook''. If you have several Gmail account, use<br />
set folder=imaps://username@imap.gmail.com/<br />
instead, where your account is ''username@gmail.com''. This way it will be possible to distinguish the different folders. Otherwise it would lead to authentication errors.<br />
<br />
=====spoolfile=====<br />
The spoolfile is the folder where your (unfiltered) e-mail arrives. Most e-mail services conventionally names it ''INBOX''. You can now use '=' or '+' as a substitution for the full {{ic|folder}} path that was configured above. For example:<br />
set spoolfile=+INBOX<br />
<br />
=====mailboxes=====<br />
Any imap folders that should be checked regularly for new mail should be listed here:<br />
mailboxes =INBOX =family<br />
mailboxes imaps://imap.gmail.com/INBOX imaps://imap.gmail.com/family<br />
<br />
Alternatively, check for all subscribed IMAP folders (as if all were added with a {{Ic|mailboxes}} line):<br />
set imap_check_subscribed<br />
<br />
These two versions are equivalent if you want to subscribe to all folders. So the second method is much more convenient, but the first one gives you more flexibility. Also, newer Mutt versions are configured by default to include a macro bound to the 'y' key which will allow you to change to any of the folders listed under mailboxes.<br />
<br />
If you do not set this variable, the ''spoolfile'' will be used by default.<br />
This variable is also important for the [[#Mutt-Sidebar|sidebar]].<br />
<br />
=====Summary=====<br />
Using these options, you will be able to start Mutt, enter your IMAP password, and start reading your mail. Here is a muttrc snippet (for Gmail) with some other lines you might consider adding for better IMAP support.<br />
{{bc|1=<br />
set folder = imaps://imap.gmail.com/<br />
set imap_user = your.username@gmail.com<br />
set imap_pass = your-imap-password<br />
set spoolfile = +INBOX<br />
mailboxes = +INBOX<br />
<br />
# Store message headers locally to speed things up.<br />
# If hcache is a folder, Mutt will create sub cache folders for each account which may speeds things even more up.<br />
set header_cache = ~/.cache/mutt<br />
<br />
# Store messages locally to speed things up, like searching message bodies.<br />
# Can be the same folder as header_cache.<br />
# This will cost important disk usage according to your e-mail amount.<br />
set message_cachedir = "~/.cache/mutt"<br />
<br />
# Specify where to save and/or look for postponed messages.<br />
set postponed = +[Gmail]/Drafts<br />
<br />
# Allow Mutt to open new imap connection automatically.<br />
unset imap_passive<br />
<br />
# Keep IMAP connection alive by polling intermittently (time in seconds).<br />
set imap_keepalive = 300<br />
<br />
# How often to check for new mail (time in seconds).<br />
set mail_check = 120<br />
}}<br />
<br />
====External IMAP support====<br />
While IMAP-functionality is built into Mutt, it does not download mail for offline-use. The [[OfflineIMAP]] article describes how to download your emails to a local folder which can then be processed by Mutt.<br />
<br />
Consider using applications such as {{pkg|spamassassin}} or {{AUR|imapfilter}} to sort mail.<br />
<br />
===POP3===<br />
''Retrieving and sorting mail with external applications''<br />
<br />
====Retrieving mail====<br />
Create the directory {{ic|~/.getmail/}}. Open the file {{ic|~/.getmail/getmailrc}} in your favorite text editor.<br />
<br />
Here is an example {{ic|getmailrc}} used with a gmail account.<br />
{{bc|1=<br />
[retriever]<br />
type = SimplePOP3SSLRetriever<br />
server = pop.gmail.com<br />
username = username@gmail.com<br />
port = 995<br />
password = password<br />
<br />
[destination]<br />
type = Maildir<br />
path = ~/mail/<br />
}}<br />
<br />
You can tweak this to your POP3 service's specification.<br />
<br />
Most people will like to add the following section to their {{ic|getmailrc}} to prevent all the mail on the server being downloaded every time getmail is ran.<br />
{{bc|1=<br />
[options]<br />
read_all = False<br />
}}<br />
<br />
As you can see {{ic|~/.getmail/getmailrc}} contains sensitive information (namely, email account passwords in plain text). You will want to change access permissions to the directory so only the owner can see it:<br />
<br />
$ chmod 700 ~/.getmail<br />
<br />
For this guide we will be storing our mail in the {{ic|maildir}} format. The two main mailbox formats are {{ic|mbox}} and {{ic|maildir}}. The main difference between the two is that {{ic|mbox}} is one file, with all of your mails and their headers stored in it, whereas a {{ic|maildir}} is a directory tree. Each mail is its own file, which will often speed things up.<br />
<br />
A {{ic|maildir}} is just a folder with the folders {{ic|cur}}, {{ic|new}} and {{ic|tmp}} in it.<br />
mkdir -p ~/mail/{cur,new,tmp}<br />
<br />
Now, run getmail. If it works fine, you can create a cronjob for getmail to run every n hours/minutes. Type {{ic|crontab -e}} to edit cronjobs, and enter the following:<br />
*/10 * * * * /usr/bin/getmail<br />
That will run {{ic|getmail}} every 10 minutes.<br />
<br />
Also, to quiet getmail down, we can reduce its verbosity to zero by adding the following to {{ic|getmailrc}}.<br />
{{bc|1=<br />
[options]<br />
verbose = 0<br />
}}<br />
<br />
=====More than one Email account with getmail=====<br />
By default, when you run {{ic|getmail}} the program searches for the file getmailrc created as seen above. If you have more than one mail account you would like to get mail from, then you can create such a file for each email address, and then tell getmail to run using both of them. Obviously if you have two accounts and two files you cannot have both of them called getmailrc. What you do is give them two different names, using myself as an example: I call one personal, and one university. These two files contain content relevant to my personal mail, and my university work mail respectively. Then to get getmail to work on these two files, instead of searching for getmailrc(default), I use the --rcfile switch like so: {{ic|getmail --rcfile university --rcfile personal}} This can work with more files if you have more email accounts, just make sure each file is in the .getmail directory and make sure to alter the cronjob to run the command with the --rcfile switches. E.g.<br />
'''*/30 * * * * /usr/bin/getmail --rcfile university --rcfile personal'''<br />
<br />
Obviously you can call your files whatever you want, providing you include them in the cronjob or shell command, and they are in the .getmail/ directory, getmail will fetch mail from those two accounts.<br />
<br />
====Sorting mail====<br />
[http://www.procmail.org/ Procmail] is an extremely powerful sorting tool. For the purposes of this wiki, we will do some primitive sorting to get started.<br />
<br />
You must edit your getmailrc to pass retrieved mail to procmail:<br />
{{bc|1=<br />
[destination]<br />
type = MDA_external<br />
path = /usr/bin/procmail<br />
}}<br />
<br />
Now, open up {{ic|.procmailrc}} in your favorite editor. The following will sort all mail from the happy-kangaroos mailing list, and all mail from your lovey-dovey friend in their own maildirs.<br />
{{bc|1=<br />
MAILDIR=$HOME/mail<br />
DEFAULT=$MAILDIR/inbox/<br />
LOGFILE=$MAILDIR/log<br />
<br />
:0:<br />
* ^To: happy-kangaroos@nicehost.com<br />
happy-kangaroos/<br />
<br />
:0:<br />
* ^From: loveydovey@iheartyou.net<br />
lovey-dovey/<br />
}}<br />
After you have saved your {{ic|.procmailrc}}, run getmail and see if procmail succeeds in sorting your mail into the appropriate directories.<br />
<br />
{{Note|One easy to make mistake with .procmailrc is the permission. procmail require it to have permission 644 and will not give meaningless error message if you do not.}}<br />
<br />
===Maildir===<br />
Maildir is a generic and standardized format. Almost every MUA is able to handle Maildirs and Mutt's support is excellent. There are just a few simple things that you need to do to get Mutt to use them. Open your muttrc and add the following lines:<br />
{{bc|1=<br />
set mbox_type=Maildir<br />
set folder=$HOME/mail<br />
set spoolfile=+/<br />
set header_cache=~/.cache/mutt<br />
}}<br />
<br />
This is a minimal Configuration that enables you to access your Maildir and checks for new local Mails in INBOX. This configuration also caches the headers of the eMails to speed up directory-listings. It might not be enabled in your build (but it sure is in the Arch-Package). Note that this does not affect OfflineIMAP in any way. It always syncs the all directories on a Server. {{ic|spoolfile}} tells Mutt which local directories to poll for new Mail. You might want to add more Spoolfiles (for example the Directories of Mailing-Lists) and maybe other things. But this is subject to the Mutt manual and beyond the scope of this document.<br />
<br />
===SMTP===<br />
Whether you use POP or IMAP to receive mail you will probably still send mail using SMTP.<br />
<br />
==== Folders ====<br />
<br />
There is basically only one important folder here: the one where all your sent e-mails will be saved.<br />
record = +Sent<br />
<br />
Gmail saves automatically sent e-mail to {{ic|+[Gmail]/Sent}}, so we do not want<br />
duplicates.<br />
unset record<br />
<br />
====Using native SMTP support====<br />
The pacman version of Mutt is also compiled with SMTP support. Just check the online manual [http://manual.cream.org/index.cgi/muttrc.5 muttrc], or {{ic|man muttrc}} for more information.<br />
<br />
For example:<br />
{{bc|1=<br />
set my_pass='mysecretpass'<br />
set my_user=myname<br />
<br />
set smtp_url=smtps://$my_user:$my_pass@smtp.domain.tld<br />
set ssl_force_tls = yes<br />
}}<br />
<br />
Note that if your SMTP credentials are the same as your IMAP credentials, then you can use those variables:<br />
<br />
{{bc|1=<br />
set smtp_url=smtps://$imap_user:$imap_pass@smtp.domain.tld<br />
}}<br />
<br />
You may need to tweak the security parameters. If you get an error like<br />
{{ic|SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol}},<br />
then your server most probably uses the SMTP instead of SMTPS.<br />
<br />
{{bc|1=<br />
set smtp_url=smtp://$imap_user:$imap_pass@smtp.domain.tld<br />
}}<br />
<br />
There is other variable that you may need to set. For example for use of STARTTLS:<br />
{{bc|1=<br />
set ssl_starttls = yes<br />
}}<br />
<br />
====External SMTP support====<br />
An external SMTP agent such as [[msmtp]], [[SSMTP]] or {{AUR|opensmtpd}} can also be used. This section exclusively covers configuring Mutt for msmtp.<br />
<br />
Edit Mutt's configuration file or create it if unpresent:<br />
{{hc|muttrc|2=<br />
set realname='Disgruntled Kangaroo'<br />
<br />
set sendmail="/usr/bin/msmtp"<br />
<br />
set edit_headers=yes<br />
set folder=~/mail<br />
set mbox=+mbox<br />
set spoolfile=+inbox<br />
set record=+sent<br />
set postponed=+drafts<br />
set mbox_type=Maildir<br />
<br />
mailboxes +inbox +lovey-dovey +happy-kangaroos<br />
}}<br />
<br />
====Sending mails from Mutt====<br />
Now, startup {{Ic|mutt}}:<br />
<br />
You should see all the mail in {{ic|~/mail/inbox}}. Press {{ic|m}} to compose mail; it will use the editor defined by your {{Ic|EDITOR}} environment variable. If this variable is not set, you can fix it before starting Mutt:<br />
$ export EDITOR=your-favorite-editor<br />
$ mutt<br />
<br />
You should store the EDITOR value into your shell resource configuration file (such as [[bashrc]]).<br />
You can also set the editor from Mutt's configuration file:<br />
{{hc|.muttrc|2=<br />
set editor=your-favorite-editor<br />
}}<br />
<br />
For testing purposes, address the letter to yourself. After you have written the letter, save and exit the editor. You will return to Mutt, which will now show information about your e-mail. Press {{ic|y}} to send it.<br />
<br />
===Multiple accounts===<br />
<br />
Now you should have a working configuration for one account at least. You might wonder how to use several accounts, since we put everything into a single file.<br />
<br />
Well all you need is to write account-specific parameters to their respective files and source them. All the IMAP/POP3/SMTP config for each account should go to its respective folder.<br />
{{Warning|When one account is setting a variable that is not specified for other accounts, you '''must unset''' it for them, otherwise configuration will overlap and you will most certainly experience unexpected behaviour.}}<br />
<br />
Mutt can handle this thanks to one of its most powerful feature: hooks.<br />
Basically a hook is a command that gets executed before a specific action.<br />
There are several hook availables. For multiple accounts, you must use account-hooks ''and'' folder-hooks.<br />
* Folder-hooks will run a command before switching folders. This is mostly useful to set the appropriate SMTP parameters when you are in a specific folder. For instance when you are in your work mailbox and you send a e-mail, it will automatically use your work account as sender.<br />
* Account-hooks will run a command everytime Mutt calls a function related to an account, like IMAP syncing. It does not require you to switch to any folder.<br />
<br />
Hooks take two parameters:<br />
account-hook [!]regex command<br />
folder-hook [!]regex command<br />
The regex is the folder to be matched (or not if preceded by the !).<br />
The command tells what to do.<br />
<br />
Let's give a full example:<br />
<br />
{{hc|.muttrc|<nowiki><br />
## General options<br />
set header_cache = "~/.cache/mutt"<br />
set imap_check_subscribed<br />
set imap_keepalive = 300<br />
unset imap_passive<br />
set mail_check = 60<br />
set mbox_type=Maildir<br />
<br />
## ACCOUNT1<br />
source "~/.mutt/work"<br />
# Here we use the $folder variable that has just been set in the sourced file.<br />
# We must set it right now otherwise the 'folder' variable will change in the next sourced file.<br />
folder-hook $folder 'source ~/.mutt/work'<br />
<br />
## ACCOUNT2<br />
source "~/.mutt/personal"<br />
folder-hook *user@gmail.com/ 'source ~/.mutt/personal'<br />
folder-hook *user@gmail.com/Family 'set realname="Bob"'<br />
</nowiki>}}<br />
<br />
{{hc|.mutt/work|<nowiki><br />
## Receive options.<br />
set imap_user=user@gmail.com<br />
set imap_pass=****<br />
set folder = imaps://user@imap.gmail.com/<br />
set spoolfile = +INBOX<br />
set postponed = +Drafts<br />
set record = +Sent<br />
<br />
## Send options.<br />
set smtp_url=smtps://user:****@smtp.gmail.com<br />
set realname='User X'<br />
set from=user@gmail.com<br />
set hostname="gmail.com"<br />
set signature="John Doe"<br />
# Connection options<br />
set ssl_force_tls = yes<br />
unset ssl_starttls<br />
<br />
## Hook -- IMPORTANT!<br />
account-hook $folder "set imap_user=user@gmail.com imap_pass=****"<br />
</nowiki>}}<br />
<br />
Finally {{ic|.mutt/personal}} should be similar to {{ic|.mutt/work}}.<br />
<br />
Now all your accounts are set, start Mutt. To switch from one account to another, just change the folder ({{ic|c}} key). Alternatively you can use the [[#Mutt-Sidebar|sidebar]].<br />
<br />
To change folder for different mailboxes you have to type the complete address -- for IMAP/POP3 folders, this may be quite inconvenient -- let's bind some key to it.<br />
<br />
{{bc|<br />
## Shortcuts<br />
macro index,pager <f2> '<sync-mailbox><enter-command>source ~/.mutt/personal<enter><change-folder>!<enter>'<br />
macro index,pager <f3> '<sync-mailbox><enter-command>source ~/.mutt/work<enter><change-folder>!<enter>'<br />
}}<br />
<br />
With the above shortcuts (or with the sidebar) you will find that changing folders (with {{ic|c}} by default) is not contextual, ''i.e.'' it will not list the folders of the current mailbox, but of the one used the last time you changed folders. To make the behaviour more contextual, the trick is to press ''='' or ''+'' for current mailbox. You can automate this with the following macro:<br />
macro index 'c' '<change-folder>?<change-dir><home>^K=<enter>'<br />
<br />
===Passwords management===<br />
Keep in mind that writing your password in {{ic|.muttrc}} is a security risk, and it might be of your concern.<br />
The trivial way to keep your passwords safe is not writing them in the config file. Mutt will then prompt for it when needed.<br />
However, this is quiet combersome in the long run, especiallly if you have several accounts.<br />
<br />
Here follows a smart and convenient solution: all your passwords are encrypted into one file and Mutt will prompt for a passphrase on startup only. You can opt for a keyring tool (e.g. GPG, {{pkg|pwsafe}}) or an encryption tool like {{pkg|ccrypt}}, which may be more simple and straightforward to use.<br />
Since GPG is a Mutt dependency, we will use it here.<br />
<br />
First create a pair of public/private keys:<br />
gpg --gen-key<br />
If you do not understand this process have a look at [[Wikipedia:Asymmetric cryptography]].<br />
<br />
Create a file '''in a secure environment''' since it will contain your passwords for a couple of seconds:<br />
{{hc|~/.my-pwds|<nowiki><br />
set my_pw_personal = ****<br />
set my_pw_work = ****</nowiki><br />
}}<br />
{{Note|Remember that user defined variables '''must''' start with {{ic|my}}}}<br />
<br />
Now encrypt the file:<br />
gpg -e -r <your-name> ~/.my-pwds<br />
Note that <your-name> must match the one you provided at the {{ic|gpg --gen-key}} step.<br />
Now you can wipe your file containing your passwords in clear:<br />
shred -xu ~/.my-pwds<br />
Back to your account dedicated files, e.g. {{ic|.mutt/personal_config}}:<br />
{{bc|1=<br />
set imap_pass=$my_pw_personal<br />
# Every time the password is needed, use $my_pw_personal variable.<br />
}}<br />
<br />
And in your {{ic|.muttrc}}, '''before''' you source any account dedicated file:<br />
{{bc|<br />
source "gpg2 -dq $HOME/.my-pwds.gpg {{ic|<nowiki>|</nowiki>}}"<br />
}}<br />
<br />
* The {{ic|-q}} parameter makes gpg2 quiet which prevents gpg2 output messing with Mutt interface.<br />
* The pipe {{ic|<nowiki>|</nowiki>}} at the end of a string is the Mutt syntax to tell that you want the result of what is preceeding.<br />
<br />
Explanation: when Mutt starts, it will first source the result of the password decryption, that's why it will prompt for a passphrase. Then all passwords will be stored in memory in specific variables for the time Mutt runs. Then when a folder-hook is called, is sets the imap_pass variable to the variable holding the appropriate password. When switching account, the imap_pass variable will be set to another variable holding another password, etc.<br />
<br />
If you use external tools like OfflineIMAP and msmtp, you need to set up an agent (e.g. gpg-agent, see [[GnuPG#gpg-agent]]) to keep the passphrase into cache and thus avoiding those tools always prompting for it.<br />
<br />
==Advanced features==<br />
Guides to get you started with using & customizing Mutt : <br />
* [http://mutt.blackfish.org.uk/ My first Mutt] (maintained by Bruno Postle) <br />
* [http://www.therandymon.com/woodnotes/mutt/using-mutt.html The Woodnotes Guide to the Mutt Email Client] (maintained by Randall Wood)<br />
* [http://stevelosh.com/blog/2012/10/the-homely-mutt The Homely Mutt] (by Steve Losh)<br />
<br />
If you have any Mutt specific questions, feel free to ask in [[ArchChannel|the irc channel]].<br />
<br />
===E-mail character encoding===<br />
You may be concerned with sending e-mail in a decent character set (charset for short) like UTF-8. Nowadays UTF-8 is highly recommended to almost everyone.<br />
<br />
When using Mutt there is two levels where the charset must be specified:<br />
* The text editor used to write the e-mail must save it in the desired encoding.<br />
* Mutt will then check the e-mail and determine which encoding is the more apropriate according to the priority you specified in the {{ic|send_charset}} variable. Default: "us-ascii:iso-8859-1:utf-8".<br />
<br />
So if you write an e-mail with characters allowed in ISO-8859-1 (like 'résumé'), but without characters specific to Unicode, then Mutt will set the encoding to ISO-8859-1.<br />
<br />
To avoid this behaviour, set the variable in your {{ic|muttrc}}:<br />
set send_charset="us-ascii:utf-8"<br />
or even<br />
set send_charset="utf-8"<br />
<br />
The first compatible charset starting from the left will be used.<br />
Since UTF-8 is a superset of US-ASCII it does not harm to leave it in front of UTF-8, it may ensure old MUA will not get confused when seeing the charset in the e-mail header.<br />
<br />
===Printing===<br />
You can install {{AUR|muttprint}} from the [[AUR]] for a fancier printing quality.<br />
In your muttrc file, insert:<br />
set print_command="/usr/bin/muttprint %s -p {PrinterName}"<br />
<br />
===Custom mail headers===<br />
One of the greatest thing in Mutt is that you can have full control over your mail header.<br />
<br />
First, make your headers editable when you write e-mails:<br />
set edit_headers=yes<br />
<br />
Mutt also features a special function {{ic|my_hdr}} for customizing your header. Yes, it is named just like a variable, but in fact it is a function.<br />
<br />
You can clear it completely, which you ''should'' do when switching accounts with different headers, otherwise they will overlap:<br />
unmy_hdr *<br />
<br />
Other variables have also an impact on the headers, so it is wise to clear them before using {{ic|my_hdr}}:<br />
unset use_from<br />
unset use_domain<br />
unset user_agent<br />
<br />
Now, you can add any field you want -- even non-standard one -- to your header using the following syntax:<br />
my_hdr <FIELD>: <VALUE><br />
Note that <VALUE> can be the result of a command.<br />
<br />
Example:<br />
{{bc|<br />
## Extra info.<br />
my_hdr X-Info: Keep It Simple, Stupid.<br />
<br />
## OS Info.<br />
my_hdr X-Operating-System: `uname -s`, kernel `uname -r`<br />
<br />
## This header only appears to MS Outlook users<br />
my_hdr X-Message-Flag: WARNING!! Outlook sucks<br />
<br />
## Custom Mail-User-Agent ID.<br />
my_hdr User-Agent: Every email client sucks, this one just sucks less.<br />
}}<br />
<br />
===Signature block===<br />
Create a .signature in your home directory. Your signature will be appended at the end of your email.<br />
Alternatively you can specify a file in your Mutt configuration:<br />
set signature="path/to/sig/file"<br />
====Random signature====<br />
You can use fortune to add a random signature to Mutt.<br />
{{bc|$ pacman -S fortune-mod}}<br />
<br />
Create a fortune file and then add the following line to your .muttrc:<br />
{{bc|1=set signature="fortune pathtofortunefile&#124;"}}<br />
Note the pipe at the end. It tells Mutt that the specified string is not a file, but a command.<br />
<br />
===Viewing URLs & opening your favorite web browser===<br />
Your should start by creating a .mutt directory in $HOME if not done yet. There, create a file named macros. Insert the following:<br />
macro pager \cb <pipe-entry>'urlview'<enter> 'Follow links with urlview'<br />
<br />
Then install {{AUR|urlview}} from the [[AUR]].<br />
<br />
Create a .urlview in $HOME and insert the following:<br />
REGEXP (((http|https|ftp|gopher)|mailto)[.:][^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):]<br />
COMMAND <your-browser> %s <br />
<br />
When you read an email on the pager, hitting ctrl+b will list all the urls from the email. Navigate up or down with arrow keys and hit enter on the desired url. Your browser will start and go to the selected site.<br />
<br />
Some browser will require additional arguments to work properly. For example, [[Luakit]] will close on Mutt exit. You need to fork it to background, using the {{ic|-n}} parameter:<br />
COMMAND luakit -n %s 2>/dev/null<br />
The {{ic|2>/dev/null}} is to make it quiet, i.e. to prevent useless message printing where you do not want them to.<br />
<br />
{{Note|urlview has a few deficiencies (e.g. the inability to handle certain email encodings) and is fairly feature-bare (e.g. it does not provide context for links it finds). There are a couple alternatives that do better. One, which can handle all email encodings and provides link context, is [http://www.memoryhole.net/~kyle/extract_url/ extract_url.pl]. Another, which can also provide link context but cannot handle all email encodings, is [https://aur.archlinux.org/packages.php?ID&#61;44853 urlscan]. Both are drop-in replacements for urlview, though extract_url has features which benefit from additional configuration changes.}}<br />
<br />
===Viewing HTML===<br />
It is possible to pass the html body to an external HTML program and then dump it, keeping email viewing uniform and unobtrusive. Three programs are described here: lynx, w3m and elinks.<br />
<br />
Install lynx, w3m or elinks:<br />
pacman -S lynx<br />
or<br />
pacman -S w3m<br />
or<br />
pacman -S elinks<br />
<br />
If {{ic|~/.mutt/mailcap}} does not exist you will need to create it and save the following to it.<br />
text/html; lynx -display_charset=utf-8 -dump %s; nametemplate=%s.html; copiousoutput<br />
or, in case of w3m,<br />
text/html; w3m -I %{charset} -T text/html; copiousoutput;<br />
or, in case of elinks,<br />
text/html; elinks -dump ; copiousoutput;<br />
<br />
Edit muttrc and add the following,<br />
set mailcap_path = ~/.mutt/mailcap<br />
<br />
To automatically open HTML messages in lynx, add this additional line to the muttrc:<br />
auto_view text/html<br />
<br />
The beauty of this is, instead of seeing an html body as source or being opened<br />
by a separate program, in this case lynx, you see the formatted content directly,<br />
and any url links within the email can be displayed with {{ic|Ctrl+b}}.<br />
<br />
If you receive many emails with multiple or alternate encodings Mutt may default to treating every email as html. To avoid this, add the following variable to your ~/.muttrc to have Mutt default to text when available and use w3m/lynx only when no text version is availble in the email:<br />
alternative_order text/plain text/html<br />
<br />
===Mutt and Vim===<br />
*To limit the width of text to 72 characters, edit your .[[vim]]rc file and add:<br />
au BufRead /tmp/mutt-* set tw=72<br />
<br />
*Another choice is to use Vim's mail filetype plugin to enable other mail-centric options besides 72 character width. Edit {{ic|~/.vim/filetype.vim}}, creating it if unpresent, and add:<br />
{{bc| <br />
augroup filetypedetect<br />
" Mail<br />
autocmd BufRead,BufNewFile *mutt-* setfiletype mail<br />
augroup END<br />
}}<br />
<br />
*To set a different tmp directory, e.g. ~/.tmp, add a line to your muttrc as follows:<br />
set tmpdir="~/.tmp"<br />
<br />
*To reformat a modified text see the Vim context help<br />
:h 10.7<br />
<br />
===Mutt and GNU nano===<br />
[[nano]] is another nice console editor to use with Mutt. <br />
<br />
To limit the width of text to 72 characters, edit your .nanorc file and add:<br />
set fill 72<br />
<br />
Also, in muttrc file, you can specify the line to start editing so that you will skip the mail header:<br />
set editor="nano +7"<br />
<br />
===Mutt and Emacs===<br />
Emacs has a ''mail'' and a ''message'' major mode.<br />
To switch to mail-mode automatically when Emacs is called from Mutt, you can add the following to your {{ic|.emacs}}:<br />
{{hc|.emacs|<nowiki><br />
;; Mutt support.<br />
(setq auto-mode-alist (append '(("/tmp/mutt.*" . mail-mode)) auto-mode-alist))<br />
</nowiki>}}<br />
<br />
If you usually run Emacs daemon, you may want Mutt to connect to it. Add this to your {{ic|.muttrc}}:<br />
{{hc|.muttrc|<nowiki><br />
set editor="emacsclient -a \"\" -t"</nowiki><br />
}}<br />
<br />
===Colors===<br />
Append sample color definitions to your .muttrc file:<br />
$ cat /usr/share/doc/mutt/samples/colors.linux >> ~/.muttrc<br />
Then adjust to your liking.<br />
The actual color each of these settings will produce depends on the colors set in your [[Xresources|~/.Xresources]] file.<br />
<br />
Alternatively, you can source any file you want containing colors (and thus act as a theme file):<br />
{{bc|<br />
source ~/.mutt/colors.zenburn<br />
}}<br />
<br />
A nice theme example:<br />
{{bc|<nowiki><br />
## Theme kindly inspired from <br />
## http://nongeekshandbook.blogspot.ie/2009/03/mutt-color-configuration.html <br />
<br />
## Colours for items in the index <br />
color index brightcyan black ~N<br />
color index brightred black ~O<br />
color index brightyellow black ~F<br />
color index black green ~T<br />
color index brightred black ~D<br />
mono index bold ~N<br />
mono index bold ~F<br />
mono index bold ~T<br />
mono index bold ~D<br />
<br />
## Highlights inside the body of a message. <br />
<br />
## URLs <br />
color body brightgreen black "(http|ftp|news|telnet|finger)://[^ \"\t\r\n]*"<br />
color body brightgreen black "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+"<br />
mono body bold "(http|ftp|news|telnet|finger)://[^ \"\t\r\n]*"<br />
mono body bold "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+"<br />
<br />
## Email addresses. <br />
color body brightgreen black "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\.[-a-z][-a-z]+"<br />
<br />
## Header <br />
color header green black "^from:"<br />
color header green black "^to:"<br />
color header green black "^cc:"<br />
color header green black "^date:"<br />
color header yellow black "^newsgroups:"<br />
color header yellow black "^reply-to:"<br />
color header brightcyan black "^subject:"<br />
color header red black "^x-spam-rule:"<br />
color header green black "^x-mailer:"<br />
color header yellow black "^message-id:"<br />
color header yellow black "^Organization:"<br />
color header yellow black "^Organisation:"<br />
color header yellow black "^User-Agent:"<br />
color header yellow black "^message-id: .*pine"<br />
color header yellow black "^X-Fnord:"<br />
color header yellow black "^X-WebTV-Stationery:"<br />
<br />
color header red black "^x-spam-rule:"<br />
color header green black "^x-mailer:"<br />
color header yellow black "^message-id:"<br />
color header yellow black "^Organization:"<br />
color header yellow black "^Organisation:"<br />
color header yellow black "^User-Agent:"<br />
color header yellow black "^message-id: .*pine"<br />
color header yellow black "^X-Fnord:"<br />
color header yellow black "^X-WebTV-Stationery:"<br />
color header yellow black "^X-Message-Flag:"<br />
color header yellow black "^X-Spam-Status:"<br />
color header yellow black "^X-SpamProbe:"<br />
color header red black "^X-SpamProbe: SPAM"<br />
<br />
## Coloring quoted text - coloring the first 7 levels: <br />
color quoted cyan black<br />
color quoted1 yellow black<br />
color quoted2 red black<br />
color quoted3 green black<br />
color quoted4 cyan black<br />
color quoted5 yellow black<br />
color quoted6 red black<br />
color quoted7 green black<br />
<br />
## Default color definitions <br />
#color hdrdefault white green <br />
color signature brightmagenta black<br />
color indicator black cyan<br />
color attachment black green<br />
color error red black<br />
color message white black<br />
color search brightwhite magenta<br />
color status brightyellow blue<br />
color tree brightblue black<br />
color normal white black<br />
color tilde green black<br />
color bold brightyellow black<br />
#color underline magenta black <br />
color markers brightcyan black<br />
<br />
## Colour definitions when on a mono screen <br />
mono bold bold<br />
mono underline underline<br />
mono indicator reverse</nowiki><br />
}}<br />
<br />
===Index Format===<br />
<br />
Here follows a quick example to put in your {{ic|.muttrc}} to customize the Index Format, i.e. the columns displayed in the folder view.<br />
{{bc|<nowiki><br />
set date_format="%y-%m-%d %T"<br />
set index_format="%2C | %Z [%d] %-30.30F (%-4.4c) %s"</nowiki><br />
}}<br />
See the [http://www.mutt.org/doc/manual/manual-6.html Mutt Reference], {{ic|man 3 strftime}} and {{ic|man 3 printf}} for more details.<br />
<br />
====Display recipient instead of sender in "Sent" folder view====<br />
<br />
By default Mutt will display the sender in the index view. It is fine for most folders, but rather useless for the one were you store a copy of your sent e-mails since it will always display your name.<br />
<br />
The "columns" of the index can be configured through the {{ic|index_format}} variable. Its syntax is documented in the {{ic|muttrc}} man page. The values of our concern are {{ic|%t}} (recipient) and {{ic|%F}} (sender).<br />
<br />
To change the columns according to the current folder, we need to use a hook:<br />
{{hc|muttrc|<nowiki><br />
folder-hook *[sS]ent* 'set index_format="%2C | %Z [%d] %-30.30t (%-4.4c) %s"'<br />
folder-hook ! *[sS]ent* 'set index_format="%2C | %Z [%d] %-30.30F (%-4.4c) %s"'<br />
</nowiki>}}<br />
<br />
The exclamation mark means ''everything that does not match the following regex''. Of course you can change the index_format following you taste, and the regular expression if the folder does not have ''Sent'' not ''sent'' in its name.<br />
<br />
<br />
====Variable column width====<br />
<br />
If you rezise the window, the subject might get truncated while there is still unused space left for some fields, like for the sender.<br />
You can get the maximum column of your terminal (i.e. the width) using a shell call to {{ic|tput cols}}. With this value you can set a percentage of the width to fields like Sender and Subject.<br />
<br />
Example using the above folder-hook and a sidebar width of 24:<br />
{{hc|muttrc|<nowiki><br />
## From field gets 30% of remaining space, Subject gets 70%.<br />
## Remaining space is the total width minus the other fields (35), minus the sidebar (24)<br />
set my_col_from = `echo $((30 * ($(tput cols)-35-24) / 100))`<br />
set my_col_subject = `echo $((70 * ($(tput cols)-35-24) / 100))`<br />
<br />
folder-hook .*[sS]ent.* 'set index_format="%2C | %Z [%d] %-$my_col_from.${my_col_from}t (%-4.4c) %-$my_col_subject.${my_col_subject}s"'<br />
folder-hook ! .*[sS]ent.* 'set index_format="%2C | %Z [%d] %-$my_col_from.${my_col_from}F (%-4.4c) %-$my_col_subject.${my_col_subject}s"'<br />
</nowiki><br />
}}<br />
<br />
Unfortunately, the above example suffers from one caveat: the {{ic|my_col_*}} variables get computed one time only, on first start. So if you want it to refresh automatically, we need to set the variable in a hook. Sadly there is no hook for window resizing, but you can still use the {{ic|folder-hook}} so that a simple folder switch suffice to recompute the view.<br />
{{hc|muttrc|<nowiki><br />
folder-hook .*[sS]ent.* 'set my_col_from = `echo $((30 * ($(tput cols)-35-24) / 100))`; set my_col_subject = `echo $((70 * ($(tput cols)-35-24) / 100))`; set index_format="%2C | %Z [%d] %-$my_col_from.${my_col_from}t (%-4.4c) %-$my_col_subject.${my_col_subject}s"'<br />
folder-hook ! .*[sS]ent.* 'set my_col_from = `echo $((30 * ($(tput cols)-35-24) / 100))`; set my_col_subject = `echo $((70 * ($(tput cols)-35-24) / 100))`; set index_format="%2C | %Z [%d] %-$my_col_from.${my_col_from}F (%-4.4c) %-$my_col_subject.${my_col_subject}s"'<br />
</nowiki><br />
}}<br />
<br />
===Contact management===<br />
<br />
====Address aliases====<br />
''Aliases'' is the way Mutt manages contacts.<br />
An alias is '''nickname [longname] <address>'''.<br />
* The '''nickname''' is what you will type in Mutt to get your contact address. One word only, and should be easy to remember.<br />
* The '''longname''' is optional. It may be several words.<br />
* An '''<address>''' must be in a valid form (i.e. with an {{ic|@}}).<br />
<br />
It is quite simple indeed. Add this to {{ic|.muttrc}}:<br />
{{bc|1=<br />
set alias_file = "~/.mutt/aliases"<br />
set sort_alias = alias<br />
set reverse_alias = yes<br />
source $alias_file<br />
}}<br />
<br />
Explanation:<br />
* {{ic|alias_file}} is the file where the information is getting stored when you add an alias from within Mutt.<br />
* {{ic|sort_alias}} specifies which field to use to sort the alias list when displayed in Mutt. Possible values: alias, address.<br />
* {{ic|reverse_alias}} sorts in reverse order if set to yes.<br />
* {{ic|source $alias_file}} tells Mutt to read aliases on startup. Needed for auto-completion.<br />
<br />
Now all you have to do when prompted {{ic|To:}} is writing the alias instead of the full address. The beauty of it is that you can auto-complete the alias using {{ic|Tab}}.<br />
Autocompleting a wrong or an empty string will display the full list. You can select the alias as usual, or by typing its index number.<br />
<br />
There is two ways to create aliases:<br />
* From Mutt, press {{ic|a}} when an e-mail of the targetted person if selected.<br />
* Edit the alias_file manually. The syntax is really simple:<br />
{{bc|<br />
alias nickname Long Name <my-friend@domain.tld><br />
}}<br />
<br />
====Abook====<br />
<br />
{{pkg|abook}} is a stand-alone program dedicated to contact management. It uses a very simple text-based interface and contacts are stored in a plain text, human-readable database. Besides the desired contact properties are extensible (birthday, address, fax, and so on).<br />
<br />
Abook is specifically designed to be interfaced with Mutt, so that it can serve as a full, more featured replacement of Mutt internal aliases. If you want to use Abook instead of aliases, remove the aliases configuration in {{ic|.muttrc}} and add this:<br />
<br />
{{hc|muttrc|<nowiki><br />
## Abook<br />
set query_command= "abook --mutt-query '%s'"<br />
macro index,pager a "<pipe-message>abook --add-email-quiet<return>" "Add this sender to Abook"<br />
bind editor <Tab> complete-query<br />
</nowiki><br />
}}<br />
<br />
See the man pages {{ic|abook}} and {{ic|abookrc}} for more details and a full configuration sample.<br />
<br />
===Request IMAP mail retrieval manually===<br />
If you do not want to wait for the next automatic IMAP fetching (or if you did not enable it), you might want to fetch mails manually.<br />
There is a mutt command {{ic|imap-fetch-mail}} for that.<br />
Alternatively, you could bind it to a key:<br />
bind index "^" imap-fetch-mail<br />
<br />
===Avoiding slow index on large (IMAP) folders due to coloring===<br />
<br />
Index highlighting by regex is nice, but can lead to slow folder viewing if your regex checks the body of the message.<br />
<br />
Use folder-hook for only highlighting in for example the inbox (if you manage to empty your mailbox effiently):<br />
<br />
folder-hook . 'uncolor index "~b \"Hi Joe\" ~R !~T !~F !~p !~P"'<br />
folder-hook ""!"" 'color index brightyellow black "~b \"Hi Joe\" ~N !~T !~F !~p !~P"'<br />
<br />
===Speed up folders switch===<br />
Add this to your {{ic|.muttrc}}:<br />
{{bc|1=<br />
set sleep_time = 0<br />
}}<br />
<br />
===Use Mutt to send mail from command line===<br />
Man pages will show all available commands and how to use them, but here are a couple of examples. You could use Mutt to send alerts, logs or some other system information, triggered by login through .bash_profile, or as a regular cron job.<br />
<br />
Send a message:<br />
mutt -s "Subject" somejoeorjane@someserver.com < /var/log/somelog<br />
<br />
Send a message with attachment:<br />
mutt -s "Subject" somejoeorjane@someserver.com -a somefile < /tmp/sometext.txt<br />
<br />
===Composing HTML e-mails===<br />
<br />
Since Mutt has nothing of a WYSIWIG client, HTML is quite straightforward, and you can do much more than with all WYSIWIG mail clients around since you edit the source code directly.<br />
Simply write your mail using HTML syntax. For example:<br />
{{bc|<nowiki><br />
This is normal text<br><br />
<b>This is bold text</b></nowiki><br />
}}<br />
Now before sending the mail, use the {{ic|edit-type}} command (default shortcut {{ic|Ctrl+t}}), and replace {{ic|text/plain}} by {{ic|text/html}}.<br />
<br />
{{Note|HTML e-mails are regarded by many people as useless, cumbersome, and subject to reading issues. Mutt can read HTML mails with a text browser like w3m or lynx, but it has clearly no advantage over a plain-text e-mail. You should avoid writing HTML e-mails when possible.}}<br />
<br />
===How to display another email while composing===<br />
A common complaint with Mutt is that when composing a new mail (or reply), you cannot open another mail (i.e. for checking with another correspondent) without closing the current mail (postponing). The following describes a solution:<br />
<br />
First, fire up Mutt as usual. Then, launch another terminal window. Now start a new Mutt with <br />
mutt -R<br />
This starts Mutt in read-only mode, and you can browse other emails at your convenience. It is strongly recommended to always launch a second Mutt in read-only mode, as conflicts will easily arise otherwise.<br />
<br />
Now, this solution calls for a bit of typing, so we would like to automate this. The following works with [[Awesome]], in other WM's or DE's similar solutions are probably available: just google how to add a key binding, and make the desired key execute <br />
$TERM -e mutt -R <br />
where $TERM is your terminal.<br />
<br />
As for Awesome: edit your rc.lua, and add the following on one of the first lines, after terminal = "yourTerminal" etc.<br />
mailview = terminal .. " -e mutt -R"<br />
This automatically uses your preferred terminal, ".." is concatenation in Lua. Note the space before -e.<br />
<br />
Then add the following inside --{{{ Key bindings<br />
awful.key({ modkey, }, "m", function() awful.util.spawn(mailview) end),<br />
<br />
Omit the final comma if this is the last line. You can, of course use another key than "m". Now, save&quit, and check your syntax with <br />
awesome -k<br />
If this is good, restart awesome and give it a try!<br />
<br />
Now, a usage example: Launch Mutt as usual. Start a new mail, and then press "Mod4"+"m". This opens your mailbox in a new terminal, and you can browse around and read other emails. Now, a neat bonus: exit this read-only-Mutt with "q", and the terminal window it created disappears!<br />
<br />
===Archive treated e-mails===<br />
When you read an e-mail, you have four choices: Answer it, Flag it, Archive it or Delete it. If you have this in mind, you can keep your inbox slim and fit with this macro (set up for Gmail):<br />
<br />
macro index \' "<tag-pattern>~R !~D !~F<enter>\<br />
<tag-prefix><save-message>+[Gmail]/All <enter>" \<br />
"Archive"<br />
<br />
===Mutt-Sidebar===<br />
<br />
The vanilla Mutt does not feature a sidebar unlike most MUAs. If you miss it, you can install {{Aur|mutt-sidebar}} from the AUR which features a patch for a list of folders on the left side of the Mutt window.<br />
<br />
For a while there has been several different patches for the sidebar. Since the late 2000's, it seems like the main patch is maintained at [http://www.lunar-linux.org/mutt-sidebar/ Lunar Linux]. See the documentation there. Note that the patch also updates the {{ic|muttrc}} man page, so have a look at the {{ic|sidebar_*}} sections.<br />
<br />
You can choose to display the sidebar on startup, or to prompt it manually with a key:<br />
{{bc|<nowiki><br />
set sidebar_visible = yes<br />
macro index b '<enter-command>toggle sidebar_visible<enter><refresh>'<br />
macro pager b '<enter-command>toggle sidebar_visible<enter><redraw-screen>'<br />
</nowiki>}}<br />
<br />
You also probabaly need some shortcuts to navigate in the bar:<br />
{{bc|<nowiki><br />
# Ctrl-n, Ctrl-p to select next, previous folder.<br />
# Ctrl-o to open selected folder.<br />
bind index,pager \CP sidebar-prev<br />
bind index,pager \CN sidebar-next<br />
bind index,pager \CO sidebar-open<br />
</nowiki>}}<br />
<br />
{{Note|You ''must'' set the {{ic|mailboxes}} variables or the {{ic|imap_check_subscribed}} to tell the sidebar which folder should be displayed. See the [[#mailboxes|mailboxes]] section.}}<br />
<br />
If you use the {{ic|imap_check_subscribed}} option to list all your folders, they will appear in an uncontrollable order in the sidebar. Fix it with<br />
set sidebar_sort = yes<br />
Note that with the {{ic|mailboxes}} option, folders appear in the order they were set to {{ic|mailboxes}} if you do not use the {{ic|sidebar_sort}} option.<br />
<br />
If you have trouble with truncated names, set the option<br />
set sidebar_shortpath = yes<br />
<br />
Finally, you may want to add a separator between different mailboxes. The sidebar patch does not currently provide any kind of separator option. A simple (and dirty) workaround is to add a fake folder to the list of folders:<br />
mailboxes "+-- My mailbox -----------"<br />
The dashes are not required, they are here just for fancy output.<br />
It will also work if you used the {{ic|imap_check_subscribed}} option.<br />
If you chose to sort the folders, the separator will not appear in the correct place, so an even more dirty workaround is to add an 'A' in front of the name. Note that punctuation is ignored during sorting.<br />
mailboxes "+A-- My mailbox -----------"<br />
<br />
===Migrating mails from one computer to another===<br />
In case you are transfering your mails to a new machine (copy&paste), you probably need to delete the header cache (a file or folder like {{ic|~/.cache/mutt}} if you followed the above configuration) to make Mutt able to read your migrated E-Mails. Otherwise Mutt may freeze.<br />
<br />
Note that if you had a folder created for you header cache, all mailboxes will have their own cache file, so you can delete caches individually without having to remove everything.<br />
<br />
=== Filtering the message view ===<br />
<br />
You can restrict the view to e-mails matching a pattern and specific properties with the {{ic|limit}} command (default shortcut: {{ic|l}}).<br />
<br />
To view all e-mails containing "foo" in the header, simply write "foo" and you are done. To remove the filter, use the "all" keyword.<br />
<br />
To view all flagged messages, use<br />
~F<br />
To view all unread messages, use<br />
~U<br />
<br />
All possible patterns are listed in the [http://www.mutt.org/doc/manual/manual-4.html#ss4.2 official manual].<br />
<br />
==Troubleshooting==<br />
<br />
===Backspace does not work in Mutt===<br />
This is a common problem with some xterm-like terminals.<br />
Two solutions:<br />
* Either rebind the key in {{ic|.muttrc}}<br />
bind index,pager ^? previous-page<br />
Note that {{ic|^?}} is one single character representing backspace in [http://en.wikipedia.org/wiki/Caret_notation caret notation]. To type in Emacs, use {{ic|Ctrl+q Backspace}}, in Vim {{ic|Ctrl+v Backspace}}.<br />
<br />
* Or fix your terminal:<br />
$ infocmp > termbs.src<br />
Edit {{ic|termbs.src}} and change {{ic|1= kbs=^H}} to {{ic|1= kbs=\177}}, then:<br />
$ tic -x termbs.src<br />
<br />
===Android's default MUA receives empty e-mail with attachment "Unknown.txt"===<br />
<br />
This is because Mutt adds 'Content-Disposition' line to every e-mail header. This line is actually correct, the issue comes from Android 2 MUA misinterpreting it. This bug seems to be fixed in the Android 4 MUA.<br />
There is a patched version for Android available in the AUR. Installing {{AUR|mutt-android-patch}} will fix the issue.<br />
<br />
===The ''change-folder'' function always prompt for the same mailbox ===<br />
<br />
This is not a bug, this is actually an intended behaviour. See the [[#Multiple accounts|multiple accounts section]] for a workaround.<br />
<br />
===I cannot change folder when using Mutt read-only (Mutt -R)===<br />
<br />
This is certainly because you are use are using macros like this one:<br />
macro index,pager <f2> '<sync-mailbox><enter-command>source ~/.mutt/personal<enter><change-folder>!<enter>'<br />
This macro tells Mutt to sync (which is a write operation) before switching.<br />
Either use the [[#Mutt-Sidebar|sidebar]] or set another macro:<br />
macro index,pager <f3> '<enter-command>source ~/.mutt/personal<enter><change-folder>!<enter>'<br />
<br />
== Documentation ==<br />
<br />
Newcomers may find it quite hard to find help for Mutt. Actually most of the topics are covered in the official documentation. We urge you to read it.<br />
<br />
* [http://www.mutt.org/doc/manual/ The official manual]. The stock {{pkg|mutt}} package for Arch Linux also installs the HTML and plain text manual at {{ic|/usr/share/doc/mutt/}}.<br />
* The {{ic|mutt}} and {{ic|muttrc}} man pages.<br />
<br />
== See also ==<br />
* [http://www.mutt.org/ The official Mutt website]<br />
* [http://wiki.mutt.org/ The Mutt wiki]<br />
* [http://pbrisbin.com/posts/two_accounts_in_mutt/ Brisbin's great guide on how to setup different IMAP accounts with Mutt, offlineimap, msmtp]<br />
* [http://home.roadrunner.com/~computertaijutsu/mutt.html A Quick Guide to Mutt]<br />
* [http://pyropus.ca/software/getmail/configuration.html#running Documentation on Configuring Getmail with rcfiles]<br />
* [http://stevelosh.com/blog/2012/10/the-homely-mutt/ Steve Losh on Mutt, offlineimap, msmtp, notmuch (gmail focussed)]<br />
* [http://www.muttrcbuilder.org/ muttrc builder]</div>Jumez