Getting started with the Linux sending mail client mutt

Source: Internet
Author: User
Tags month name



Understanding mutt is an attractive article about Wang's mutt from the past few years. I always wanted to try it out when I like vim-like full-keyboard operations. It is difficult to get started. In addition, I have been running WINXP, so my thoughts have been stranded.

In the past two days, I finally picked up my interest and learned the basic configurations. I started my mutt journey.

System: ubuntu7.4
I have been using the built-in evolution. Now I can switch to mutt!

Sudo apt-Get install mutt main program
Sudo apt-Get install msmtp used for sending emails
Sudo apt-Get install getmail4 is used to receive emails

Sudo apt-Get install ca-certificates libssl0.9.8 OpenSSL SSL-cert for Gmail

Basic settings Enable email receiving and receiving
Create a directory file
You can store emails by directory or file.
Mkdir-P ~ /Mail/inbox/{cur, new, TMP}

The following two groups of directories should be automatically created by mutt
Mkdir-P ~ /Mail/sent/{cur, new, TMP}
Mkdir-P ~ /Mail/postponed/{cur, new, TMP}

Configure msmtp
Modify configuration file ~ /. Msmtprc File
Account <account_name>
Host <SMTP address>
From <email address>
Auth <authentication method, generally including plain, login, NTLM, etc.>
User <email address>
Password <email password>

Modify configuration file ~ /. Muttrc File
# Msmtp settings
Set Sendmail = "/usr/bin/msmtp"
Set use_from = Yes
Set From = <email address>
Set envelope_from = Yes

Configure getmail4
Modify configuration file ~ /. Getmail/getmailrc file:
Verbose = 1
Read_all = false
Message_log = ~ /. Getmail/log

Type = simplepop3retriever
Server = <POP3 server address>
Username = <email address>
Password = <email password>

Type = maildir
Path = ~ /Mail/inbox/

Receive email
Receive a new email. Run getmail-N in the command line.

Emails are received every 10 minutes:
Set crontab
$ Crontab-e
/10 */usr/bin/getmail

Contact List
Save it in a separate file:
~ /. Mutt. Alias

Configuration File Settings:
# Address book
Source ~ /. Mutt. Alias
# Which alias file is used to save the alias when the sender obtains the alias.
Set alias_file = ~ /. Mutt. Alias

In the mutt email list
A adds the sender of the current email to the list

When entering the recipient address, you only need to enter the first few letters of the alias, Tab.

Mail sorting
On the mutt Mail List homepage:
Use o for forward sorting and O for reverse sorting.
The sorting methods include:
Time, sender, thread, and topic

Use L to display some emails
Enter all to indicate all emails. You can enter the sender's name and some key words of the subject.

Add different logos to emails
Email status flag description:
% Z is used in index_format.
Generally, $ to_chars is defined as "+ TCFL ".
"" (Blank): indicates that this email is not sent to you, that is, to: and CC: BCC: do not have your address, many forwarded emails, unconfirmed list emails, spam has this feature.
+: Indicates that you are the recipient (to: Is One Of Your addresses) and the only recipient.
T: indicates that you are the recipient (to: includes one of your addresses), but you are not the only recipient. This is a group letter.
C: indicates that your address appears in CC:, but you are not the only CC recipient.
F: You sent this email.
L: It indicates that this is sent from the list of emails you have added.

! : Indicates important emails. Use the f key to switch.
*: Indicates a signed email. Use the T key to switch.
N: indicates that the new email has not been read. Set it with the N key.
O: indicates that the old email has not been read.
R: indicates the replied email.

Set different colors
# Color settings
Color Error red white # error prompt bar
Color status white blue # Status Bar
Color hdrdefault magenta default

Color index yellow default ~ N # New
Color index yellow default ~ O # Old
Color index red default ~ F # flagged
Color index cyan default ~ T # tagged
Color index blue default ~ D # deleted

Automatically add a signature for email writing
Adding a signature file is done by the editor and has nothing to do with Mutt.
Set Vim as the editor:
Set Editor = "Vim" # Set the Default Editor

In ~ /. Add the following to vimrc:
"For mutt
Autocmd bufenter mutt-Aaron-PC * 0R ~ /. Vim/template/mail. Mutt
And write the file mail. Mutt as the signature file.

Adjust the content displayed in the email list
For example, you want to display: date, time, sender, topic, attachment, Tag, size

In the configuration file ~ /. Add the following to muttrc:
# Serial Number status [date (strftime format)] [number of attachments] sender mail size mail title
Set index_format = "% 4C % Z [% {% Y-% m-% d % H: % m}] [% x] %-15.15l (% 4c) % s"

Strftime format
% A the abbreviation of the day of the week.
% A full name of the day of the week.
The abbreviation of % B month name.
% B full name of the month name.
% C the local date time is better than the string.
% D indicates the day of the month (range: 00 to 31) with a number ).
% H indicates the hour in the 24-hour format (ranging from 00 to 23 ).
% I represents the hour in 12-hour format (range: 01 to 12 ).
% J indicates the day of the year (range: 001 to 366 ).
The number of % m months (ranging from 1 to 12 ).
% M minutes.
% P uses 'am' or 'pm 'to indicate the local time.
% S seconds.
% U indicates the week of the current year. The first week starts from the first Sunday.
% W indicates the week of the current year. The first week starts from the first Monday.
% W indicates the day of the week by number (0 indicates Sunday ).
% X date representation without time.
% X does not include the time representation of the date.
The two digits % Y indicate the year (range: 00 to 99 ).
% Y indicates the complete year number, that is, the four-digit number.
% Z time zone or abbreviated name.
% Characters.

To delete a mail to the trash directory, delete it in the trash directory:

# Delete to the trash directory
Folder-hook. 'macro index D "s ~ /Mail/trash/R "'
Folder-hook ~ /Mail/trash 'Bind index D Delete-message'

Mutt has many basic configurations. For more information, see other articles. Here, I just paste some special settings!



Related Links

Sending emails in Linux: Intermediate mutt skills

Sending mail commands in Linux: mutt, mail, and script

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.