https://wiki.archlinux.org/api.php?action=feedcontributions&user=Abcascii&feedformat=atomArchWiki - User contributions [en]2024-03-28T14:53:44ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Mutt&diff=507429Mutt2018-01-13T16:09:34Z<p>Abcascii: fix link to pattern docs in /* Filtering the message view */</p>
<hr />
<div>[[Category:Email clients]]<br />
[[es:Mutt]]<br />
[[it:Mutt]]<br />
[[ja:Mutt]]<br />
[[zh-hans:Mutt]]<br />
[[zh-hant:Mutt]]<br />
{{Related articles start}}<br />
{{Related|fdm}}<br />
{{Related|msmtp}}<br />
{{Related|offlineimap}}<br />
{{Related|isync}}<br />
{{Related articles end}}<br />
[http://www.mutt.org/ Mutt] is a text-based mail client renowned for its powerful features. Though over 2 decades old, Mutt remains the mail client of choice for a great number of power-users.<br />
<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 />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|mutt}} package. Alternatively consider using the [[#NeoMutt]] package.<br />
<br />
Optionally install external helper applications for an IMAP setup, such as [[isync]], [[OfflineIMAP]], or [[msmtp]].<br />
<br />
Or (if using POP3) {{Pkg|getmail}}, {{Pkg|fetchmail}} 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 />
=== NeoMutt ===<br />
<br />
{{Move|NeoMutt|Is it a drop-in replacement for mutt? Do all configurations on this page apply to it as well?|section=Neomutt}}<br />
<br />
The [http://www.neomutt.org/ NeoMutt] project aims to bring together all the patches for Mutt. It adds a large set of [http://www.neomutt.org/feature.html features]. Lots of old Mutt patches have been brought up-to-date, tidied and documented.<br />
<br />
While there are many different packages of mutt in the AUR, each of them providing another set of patches, NeoMutt aims to replace them in the future by implementing appropriate compile options.<br />
<br />
NeoMutt can be installed with the {{Pkg|neomutt}} package or alternatively from the AUR at {{AUR|neomutt-git}} for the development version.<br />
<br />
== Configuration ==<br />
<br />
This section covers [[#IMAP]], [[#POP3]], [[#Maildir]] and [[#SMTP]] configuration.<br />
<br />
Note that Mutt will recognize by default two locations for its configuration file; {{ic|~/.muttrc}} and {{ic|~/.mutt/muttrc}}. Either location will work. In case you decide to put the initialization file somewhere else, use {{ic|$ mutt -F /path/to/.muttrc}}.<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 variables '''must begin with "my"!'''<br />
set my_name = "John Doe"<br />
<br />
===IMAP===<br />
<br />
====Native IMAP support====<br />
The {{Pkg|mutt}} package is compiled with IMAP support. At the very least you need to have four lines in your muttrc file to be able to access your mail.<br />
<br />
=====imap_user=====<br />
set imap_user=USERNAME<br />
<br />
{{Tip|Continuing with the previous example, remember that Gmail requires your full email address (this is not standard): {{bc|1=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 />
{{Tip|If you have enabled two-factor authentication in Gmail and you have added an application specific password for Mutt, you will want to use that password here rather than your regular Gmail password.}}<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 name 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 [[#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 up even more.<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 a new IMAP connection automatically.<br />
unset imap_passive<br />
<br />
# Keep the 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 support is built into Mutt, it does not download mail for offline use. It is possible to use an external application such as [[OfflineIMAP]] or [[isync]] 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 />
<br />
The {{Pkg|mutt}} package is compiled with POP3 support, which is configured via the {{ic|pop_*}} variables as described in {{ic|muttrc(5)}}.<br />
<br />
Alternatively, it is possible to use external programs to fetch mail using POP3. One popular option is to use [[getmail]] for retrieving and [[procmail]] for filtering the mail.<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=~/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 all of the 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 />
set record = +Sent<br />
<br />
Gmail automatically saves sent e-mail to {{ic|+[Gmail]/Sent}}, so we do not want<br />
duplicates.<br />
unset record<br />
<br />
====Native SMTP support====<br />
The {{Pkg|mutt}} package is compiled with SMTP support.<br />
<br />
For example:<br />
{{bc|1=<br />
set my_pass='mysecretpass'<br />
set my_user=myname<br />
<br />
set realname = 'Your Real Name'<br />
set from = your-email-address<br />
set use_from = yes<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 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 are other variables that you may need to set. For example for use of STARTTLS:<br />
{{bc|1=<br />
set ssl_starttls = yes<br />
}}<br />
<br />
See {{man|5|muttrc}} for more information.<br />
<br />
====External SMTP support====<br />
<br />
An external SMTP agent such as [[msmtp]], [[SSMTP]] or {{Pkg|opensmtpd}} can also be used.<br />
<br />
The {{ic|sendmail}} variable in your {{ic|muttrc}} determines the program and arguments used to deliver mail in mutt. Any additional arguments must be interpreted by the program as recipient addresses.<br />
<br />
For example, if using [[msmtp]]:<br />
<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 />
{{Warning|If at this point you press {{ic|q}} by accident, Mutt will ask you {{ic|Postpone this message? ([yes]/no)}}. This is really asking whether you want to save the message you just wrote. If you press "n" (perhaps because you want to edit the message again) the message will be permanently deleted. When using Mutt, always remember that "Postpone this message?" really means "Save this message?".}}<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 features: hooks.<br />
Basically a hook is a command that gets executed before a specific action.<br />
There are several hooks available. 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 every time 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 us 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 [[#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 us 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. One solution is to always enter the password manually, but this becomes cumbersome.<br />
<br />
An alternative solution is to encrypt your password with [[GnuPG]] in an encrypted file. [[GnuPG#Create_key_pair|Setup your own keypair]] if you have not done so already. [[Create]] a file in a [[tmpfs]] with the following contents:<br />
<br />
set my_pass = "'' password''"<br />
<br />
{{Note|Remember that user defined variables '''must''' start with {{ic|my_}}.}}<br />
<br />
Then [[encrypt]] this file, setting yourself as the recipient and move it into an accessible location. In this example the encrypted file resides at $HOME/.my-pwds.gpg.<br />
<br />
In your mutt configuration file add the following before any account:<br />
<br />
source "gpg -dq $HOME/.my-pwds.gpg |"<br />
<br />
{{Note|At the end of the line above, there is no space between the pipe and the double quote.}}<br />
<br />
This decrypts the file quietly and sets the variable {{ic|my_pass}} in this example. This can be used in any variable after it has been source. For example:<br />
<br />
{{bc|1=<br />
set imap_pass=$my_pass<br />
}}<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 />
==== Security concern ====<br />
<br />
If {{ic|enter-command}} is available from the UI, it is possible to see the password unencrypted, which may be undesired if anybody else than you has access to your session while Mutt is running. You may want to disable it for this reason. As a consequence, every command that the user intends to use must be bound to a key in advance, otherwise it will never be accessible.<br />
{{hc|.muttrc|<br />
bind generic,alias,attach,browser,editor,index,compose,pager,pgp,postpone ':' noop<br />
}}<br />
<br />
== Tips and tricks ==<br />
<br />
Guides to get you started with using & customizing Mutt :<br />
* [http://mutt.postle.net/ 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 />
* [http://codesorcery.net/old/mutt/mutt-gnupg-howto Everything You Need To Know To Start Using GnuPG with Mutt] (by Justin R. Miller)<br />
<br />
If you have any Mutt specific questions, feel free to ask in [[ArchChannel|the irc channel]].<br />
<br />
===Key bindings===<br />
<br />
The default key bindings are quite far from the more common Emacs-like or Vi-like bindings.<br />
You can customize them to your preference. Mutt has a different set of bindings for the pager, the index, the attachment view, etc. Thus you need to specify which ''map'' you want to modify when you bind a key. You can review the list of commands and key bindings from Mutt's help page (default key: {{ic|?}}).<br />
Example of Vi-like bindings:<br />
{{hc|muttrc|<nowiki><br />
bind pager j next-line<br />
bind pager k previous-line<br />
bind attach,index,pager \CD next-page<br />
bind attach,index,pager \CU previous-page<br />
bind pager g top<br />
bind pager G bottom<br />
bind attach,index g first-entry<br />
bind attach,index G last-entry<br />
</nowiki>}}<br />
<br />
===Composition===<br />
<br />
==== Encrypt and sign mail (GnuPG) ====<br />
<br />
To start encrypting mail in mutt using [[GnuPG]] copy {{ic|/usr/share/doc/mutt/samples/gpg.rc}} to your mutt configuration folder (e.g., to {{ic|~/.mutt/gpg.rc}}). Then [[append]] the following to your mutt configuration file (e.g., {{ic|~/.mutt/mutrrc}}):<br />
<br />
source ~/.mutt/gpg.rc<br />
<br />
Most encryption options are then available by pressing {{ic|p}} in the compose view<br />
<br />
See the {{ic|pgp_*}} and {{ic|crypt_*}} options in {{man|5|muttrc}}.<br />
<br />
====E-mail character encoding====<br />
<br />
When using Mutt there are two levels where the character sets that 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 appropriate 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 />
====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 />
<br />
=====Random signature=====<br />
You can use ''fortune'' (package {{Pkg|fortune-mod}}) to add a random signature to Mutt.<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 />
====Compose and send 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 />
====Compose 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 />
====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 />
{{Note|When changing folders (with {{ic|c}} or {{ic|y}}) the read-only mode is not preserved. Instead {{ic|Esc c}} has to be used.}}<br />
<br />
{{Tip|This solution calls for a bit of typing, so it is suitable to bind the following command to a keyboard shortcut (see [[Extra keyboard keys]] for details):<br />
$TERMINAL -e mutt -R<br />
where {{ic|$TERMINAL}} is your terminal.}}<br />
<br />
===Printing===<br />
You can install {{AUR|muttprint}} for fancier printing quality.<br />
In your muttrc file, insert:<br />
set print_command="/usr/bin/muttprint %s -p {PrinterName}"<br />
<br />
===Viewing content===<br />
<br />
====Viewing URLs in a 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 the {{AUR|urlview}} package.<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 {{AUR|urlscan-git}}. 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: {{Pkg|lynx}}, {{Pkg|w3m}} and {{Pkg|elinks}} (make sure the selected package is [[pacman|installed]]).<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 -assume_charset=%{charset} -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, w3m or elinks 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}}, assuming you have {{aur|urlview}} installed.<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 />
Some HTML mails may not display correctly in a text-based web browser. As a fallback solution, you can bind a key to open a graphical browser in such cases.<br />
The following macro will open the HTML mail selected from the attachment view in the web browser defined in the environment. (Feel free to adapt the {{ic|~/.cache/mutt/}} folder).<br />
macro attach 'V' "<pipe-entry>cat >~/.cache/mutt/mail.html && $BROWSER ~/.cache/mutt/mail.html && rm ~/.cache/mutt/mail.html<enter>"<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 that are either of size ≥1MB or from johndoe, use<br />
~U (~z 1M- | ~f johndoe)<br />
<br />
All possible patterns are listed in the [http://www.mutt.org/doc/manual/#patterns official manual].<br />
<br />
==== Conversation grouping ====<br />
<br />
The default sort order is by date. Use the {{ic|sort-mailbox}} command (default key: {{ic|o}}) to change the sorting option.<br />
You can group e-mails by conversation/thread, in which case you can define how to sort threads and how to sort within a thread.<br />
<br />
In the following example, threads are sorted according to the date of their last e-mail.<br />
<br />
{{hc|muttrc|<nowiki><br />
set sort=threads<br />
set sort_aux=last-date-received<br />
</nowiki>}}<br />
<br />
===Configuring editors to work with mutt===<br />
====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 />
====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 />
====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 />
===Display settings===<br />
<br />
====Colors====<br />
[[Append]] the contents of {{ic|/usr/share/doc/mutt/samples/colors.linux}} to your .muttrc file, or copy and source it. Then adjust to your liking.<br />
<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). See [http://nongeekshandbook.blogspot.be/2009/03/mutt-color-configuration.html] for a theme example.<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/#index-format Mutt Reference], {{man|3|strftime}} and {{man|3|printf}} for more details.<br />
<br />
====Display recipient instead of sender in "Sent" folder view====<br />
<br />
By default Mutt uses the {{ic|%L}} format string in the {{ic|index_format}} variable, which will display:<br />
<br />
* "To <list-name>", if an address in the "To:" or "Cc:" header field matches an address defined by the user's {{ic|subscribe}} command.<br />
* Otherwise it displays the author name, or recipient name if the message is from you.<br />
<br />
If you use multiple email addresses in the same mailbox, make sure to configure the [https://dev.mutt.org/trac/wiki/UseCases/MultiAccounts#Settinguptheaddresses:alternates alternates variable], so that Mutt knows which messages were from you.<br />
<br />
====Variable column width====<br />
<br />
If you resize 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 number of columns supported by 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_index_format_pre='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}'<br />
set my_index_format_post=' (%-4.4c) %?M?<%M> ?%-$my_col_subject.${my_col_subject}s"'<br />
<br />
folder-hook .*[sS]ent.* "$my_index_format_pre"t"$my_index_format_post"<br />
folder-hook ! .*[sS]ent.* "$my_index_format_pre"F"$my_index_format_post"<br />
</nowiki><br />
}}<br />
<br />
We ''must'' set the variables {{ic|my_col_from}} and {{ic|my_col_from}} from within the hooks. Otherwise, the column values will not get re-computed.<br />
<br />
We can add a binding to force re-computing the index format without changing folder:<br />
{{hc|muttrc|<nowiki><br />
macro index,pager \CL "<enter-command>$my_index_format_pre"F"$my_index_format_post<enter><redraw-screen>"<br />
</nowiki><br />
}}<br />
<br />
====Sidebar====<br />
<br />
Example settings for a sidebar are in {{ic|/usr/share/doc/mutt/samples/sample.muttrc-sidebar}}, including keybindings. Copy, edit, and source that file in your mutt configuration file. Be sure to change {{ic|1=set sidebar_visible = yes}}.<br />
<br />
[[Append]] the following in order to toggle the sidebar visibility:<br />
{{bc|<nowiki><br />
bind index,pager B sidebar-toggle-visible<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 />
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_method}} option.<br />
<br />
{{Tip|To add a separator between different mailboxes, add a fake folder to the list of folders For example add:<br />
mailboxes "+-- My mailbox -----------"}}<br />
<br />
==== Display the index above the pager view ====<br />
<br />
Set the following variable in your {{ic|muttrc}}:<br />
set pager_index_lines=10<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}} if set to yes mutt will display the "personal" name from your aliases in the index menu if it finds an alias that matches the message's sender.<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 are 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 />
====Goobook====<br />
<br />
Goobook allows you to search your Google contacts from the command line or from within Mutt and can be installed with the {{AUR|goobook-git}} package.<br />
<br />
Before using goobook you must configure {{ic|~/.goobookrc}}. To generate the default template:<br />
$ goobook config-template > ~/.goobookrc<br />
<br />
See {{ic|~/.goobookrc}} for configuration options. At a minimum, you will need to enter your '''email''' and '''password'''.<br />
<br />
{{Note|If you have two-step verification enabled with the Google account, you may need to generate an application password.<br />
}}<br />
<br />
If you want to use Goobook instead of aliases, remove any alias configuration in {{ic|.muttrc}} and add:<br />
{{hc|muttrc|<nowiki><br />
## GooBook<br />
set query_command="goobook query '%s'"<br />
macro index,pager a "<pipe-message>goobook add<return>" "add sender to google contacts"<br />
bind editor <Tab> complete-query<br />
</nowiki><br />
}}<br />
<br />
When composing an email message within mutt, {{ic|Tab}} will now search your Google contacts. While viewing messages {{ic|a}} will add the sender to Google contacts.<br />
<br />
====Khard====<br />
<br />
{{AUR|khard}} is a command-line addressbook that is able to sync with CardDAV-servers.<br />
<br />
===Manage multiple sender accounts===<br />
<br />
If you use multiple sender accounts, you can automatically associate a specific sender account with a recipient. {{AUR|mutt-vid}} scans sent emails for the most recent "From" details associated with specific recipients, saving these in a file for mutt to source. The next time you email this recipient, mutt will automatically invoke a send-hook with the same email address and real name that you used previously. See mutt-vid's [https://github.com/protist/mutt-vid homepage] for more details.<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 />
===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 />
===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 />
=== Default folder for saving attachments ===<br />
<br />
By default Mutt will save attachments to the folder it was started from. If you want to always set the default destination to {{ic|~/attachments}}, you can create the following alias, which launches Mutt in this folder:<br />
<br />
alias mutt='cd ~/attachments && mutt'<br />
<br />
=== Pager behavior ===<br />
<br />
Show context lines when going to next page:<br />
<br />
set pager_context=3<br />
<br />
Stop at the end instead of displaying next mail:<br />
<br />
set pager_stop=yes<br />
<br />
=== Fast reply ===<br />
<br />
By default Mutt will ask to confirm the recipient and the subject when you reply to an e-mail.<br />
It will also ask if you want to include the original mail in your answer.<br />
If you assume you will always stick to the default values, you can set up Mutt to skip these questions:<br />
<br />
{{hc|muttrc|<nowiki><br />
set fast_reply=yes<br />
set include=yes<br />
</nowiki>}}<br />
<br />
You can still edit the recipient and the subject before sending.<br />
<br />
=== Ignore own e-mail addresses from group-reply ===<br />
<br />
Mutt will include your e-mail address(es) in the recipient list when you group-reply to a mail you were CC'ed.<br />
You can ask Mutt to ignore some addresses with:<br />
<br />
alternates mail1@server1|mail2@server2|...<br />
<br />
=== IMAP message cache ===<br />
<br />
When using the built-in IMAP support, e-mails are fetched in memory by default. Retrieving a big e-mail several times will download it from your IMAP server that many times.<br />
<br />
Alternatively, you can ask Mutt to store all fetched messages on disk:<br />
{{hc|muttrc|<nowiki><br />
set message_cachedir=~/.cache/mutt/messages<br />
</nowiki>}}<br />
(The folder must exist.) This will make any future retrieval instantaneous, even with big attachments.<br />
<br />
If you want to purge the cache from its oldest e-mails exceeding a limit of, say, 50MB, you can use a script like the following:<br />
<br />
{{hc|~/.mutt/purgecache.sh|<nowiki><br />
#!/bin/sh<br />
<br />
## In KB.<br />
CACHE_LIMIT=51200<br />
<br />
cd "$1" 2>/dev/null<br />
[ $? -ne 0 ] && exit<br />
<br />
[ $(du -s . | cut -f1 -d' ') -lt $CACHE_LIMIT ] && exit<br />
while IFS= read -r i; do<br />
rm "$i"<br />
[ $(du -s . | cut -f1 -d' ') -lt $CACHE_LIMIT ] && exit<br />
done <<EOF<br />
$(find . -type f -exec ls -rt1 {} +)<br />
EOF<br />
</nowiki>}}<br />
<br />
and call it on startup:<br />
<br />
{{hc|muttrc|<nowiki><br />
set message_cachedir=~/.cache/mutt/messages<br />
source "~/.mutt/purgecache.sh '$message_cachedir'|"<br />
</nowiki>}}<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-line<br />
Note that {{ic|^?}} is one single character representing backspace in [[wikipedia: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 />
===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 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 [[#Sidebar|sidebar]] or set another macro:<br />
macro index,pager <f3> '<enter-command>source ~/.mutt/personal<enter><change-folder>!<enter>'<br />
<br />
===Error sending message, child exited 127 (Exec error.).===<br />
This is an SMTP error. It means that mutt does not know how to send the message.<br />
You can either try installing sendmail and see if that solves your issue, or you can set the smtp_url variable. If you use gmail, you can add the following to your muttrc to tell mutt to use gmails smtp server.<br />
<br />
set smtp_url=smtps://$imap_user:$imap_pass@smtp.gmail.com<br />
<br />
Take note of the smtps protocol, it is important.<br />
This should solve the problem.<br />
<br />
===Character encoding problems===<br />
<br />
If you are having problems with character encoding, first read [http://dev.mutt.org/trac/wiki/MuttFaq/Charset this section] in the Mutt wiki.<br />
<br />
If Chinese text is still garbled, it may help to decode with GBK even when GB2312 is specified in the header. You can do this with {{ic|iconv}} by adding the following to your {{ic|mailcap}} file:<br />
text/plain; iconv -f gbk -t utf-8 %s; test=echo "%{charset}" | grep -ic "gb2312"; copiousoutput;<br />
and enabling it by adding a line to your {{ic|.muttrc}}:<br />
auto_view text/plain<br />
For HTML emails, you can edit the relevant line of your mailcap by replacing {{ic|<nowiki>%{charset}</nowiki>}} with {{ic|<nowiki>$(echo %{charset} | sed s/gb2312/gbk/I)</nowiki>}}, for example:<br />
text/html; w3m -dump -I $(echo %{charset} | sed s/gb2312/gbk/I) %s; nametemplate=%s.html; copiousoutput<br />
<br />
===Unable to login with GMail===<br />
<br />
Gmail disables access from apps it considers less secure, including {{ic|mutt}}. You can enable access by following the instructions [https://support.google.com/accounts/answer/6010255 here]<br />
<br />
===Not possible to open too long URLs with urlview===<br />
Too long URLs are not parsed correctly, because urlview does not decode text (see [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=127090]). You can let mutt decode the e-mails instead. Replace the line for opening urlview with the following code:<br />
<br />
macro index \cb "\<br />
:set my_tmp_pipe_decode=\$pipe_decode\n\<br />
:set pipe_decode\n\<br />
|urlview\n\<br />
:set pipe_decode=\$my_tmp_pipe_decode\n\<br />
:unset my_tmp_pipe_decode\n" \<br />
'call urlview to extract URLs out of a message'<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://www.mutt.org/doc/manual/ Official Manual]<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://srobb.net/mutt.html A Quick Guide to Mutt]<br />
* [http://stevelosh.com/blog/2012/10/the-homely-mutt/ Steve Losh on Mutt, offlineimap, msmtp, notmuch (focused on Gmail)]<br />
* [http://www.muttrcbuilder.org/ muttrc builder]</div>Abcascii