Mutt configuration fileBefore you start using Mutt to send and receive emails, you need to configure it. This you do by creating a Mutt configuration file named
.muttrcin your home folder.
.muttrcfile is different. It can contain as little as your email id and POP/IMAP configuration or as much details as even setting the color of your Mutt interface.
As an example, When you read email using Mutt, by default you see the header of the email along with the message. You can hide all the email headers except the
From:fields along with the actual message by inserting the following lines in your
# File .muttrc # ... ignore * unignore From: To: Cc: Subject: Date: # ...
Any line starting with a
# is a comment in
A few examples of using MuttIf your email account has POP3 access and you want to read the mail in Mutt, you can try the following command -
$ mutt -f pop://pop.myserver.com
pop.myserver.comabove with the POP3 server address of your email provider.
If you want to send and receive email securely, then use the command -
$ mutt -f pops://pop.myserver.com
To send email from the command line with a subject, use the following command -
$ mutt -s "subject line" email@example.com
To send an attachment with your message from command line -
$ mutt -s "attachment" -a data.doc firstname.lastname@example.org
How to access Gmail from Mutt
Finally, let me share with you my
.muttrcfile which I use to read mail from my Gmail account. It is a simple setup that uses IMAP in Gmail to access my mail.
You can reuse it for reading mails in your Gmail account too. Just change the strings highlighted in red to your own settings.
# Header stuff ignore "Authentication-Results:" ignore "DomainKey-Signature:" ignore "DKIM-Signature:" hdr_order Date From To Cc ignore * unignore from: date subject to cc unignore x-mailing-list: posted-to: unignore x-mailer: # For better looks set markers=no # don't put '+' at the beginning of wrapped lines set pager_index_lines= 5 # how large is the index window? set sort = 'threads' set sort_aux = 'last-date-received' # Gmail SETUP set from = "email@example.com" set realname = "Ravi" set imap_user = "firstname.lastname@example.org" set imap_pass = "my-gmail-password" set folder = "imaps://imap.gmail.com:993" set spoolfile = "+INBOX" set postponed ="+[Gmail]/Drafts" set trash = "imaps://imap.gmail.com/[Gmail]/Trash" set header_cache =~/.mutt/cache/headers set message_cachedir =~/.mutt/cache/bodies set certificate_file =~/.mutt/certificates # SMTP settings for sending mail via Gmail set smtp_url = "smtp://email@example.com:587/" set smtp_pass = "my-gmail-password" bind editor
noop macro index gi " =INBOX " "Go to inbox" macro index ga " =[Gmail]/All Mail " "Go to all mail" macro index gs " =[Gmail]/Sent Mail " "Go to Sent Mail" macro index gd " =[Gmail]/Drafts " "Go to drafts" set move = no #Stop asking to "move read messages to mbox"! set imap_keepalive = 900
For a detailed explanation of the configuration listed above, visit this page.
There is a site called muttrcbuilder.org that will automatically create a
.muttrc file for you.
How to install Mutt in LinuxMutt mail client is available in most Linux distributions. You can install Mutt from the repository of your respective Linux distribution.
Further ReadingMutt home page
Dave's .muttrc file