Getting started with mutt email programs

xiaoxiao2021-03-06  38

Getting started with mutt email programs

"All Mail Clients Suck. This One Just Sucks Less." -Me, Circa 1995

You may have heard this sentence? This is not a dramatic, I haven't encountered an email program that makes me satisfied until I encounter MUTT. It is not a graphical interface, but it is very powerful and convenient. I used it to ignore it, but later I found some other Email programs to have some kind of blame I don't like. Finally I chose MUTT.

Some people say that GNUS is the best Email client, but GNUS wants to achieve Mutt, and you need to pay too much price. So I would rather use MUTT to call Emacs to edit Email without paying GNUS configuration to process Email.

MUTT characteristics

MUTT has the following features:

Super letter classification

You can set almost anything to find the seal you need from a bunch of letters. For example, you can say: "Only a month, is not sent by Tsinghua University, the content contains two words of the 'CD'," "put it from the FVWM mailing list, and has not seen it yet All letters are all moved to the mailbox called OLD-FVWM ......

Letter score sorting function

You can score your letter, such as I said:

The theme contains 3 points of "Circulation Notices". Otherwise, be careful from the library: P

From my father, the letter 2 points. Listen to my father ...

The topic contains two words 2 points of "notification". I will listen to the call of the party at any time.

The theme contains "Believe Me", "Believe. * DREAM", "Win. * Free", -1 points. These are generally advertising.

New letters 4 points. New should look the best.

New and last forgot reading letters (OLD), 1 points. It may be too busy to last forgotten, this time you should look at it.

The final score of the letter is the result of these scores added. After doing this, the letters you most want to see is definitely the top.

Almost any conditional color settings

You see my MUTT can become this. Of course, this is too spent, I will not set up so many colors.

Can be bound free of charge

This feature is similar to EMACS. You can bind almost any function to the keyboard. You can make MUTT's behavior into your favorite editor. For example, I am used to the control method of Vim, I bind "gg" to "first-entry", bind "g" to "Last-Entry", bind "Ctrl-F" to Next-Page, Bind "CTRL-B" to Previous-Page.

Set condition hook

You can take different settings for letters that meet different conditions. For example, for those mailboxes used to collect mail, only the mail headers are displayed when the message is displayed, and the Sent-Mail mailbox is also displayed to the mail header; send me family, friend The letters are saved in a special mailbox.

Batch email processing

You can make some messages to mark (tag), then consent to them, such as delete, save other files, delete attachments, ...

Optional editor

Use a powerful editor to edit your email you can complete the editing. The general email client is an editor that is in-embedded, which is very weak in these editors. MUTT does not try to write an editor yourself because it is obviously not more than Vim and Emacs, so MUTT can make you choose your favorite editor, it will call it, and set a lot of convenient editing Email parameters. After the editor edited, MUTT will be edited from the editor, and then you can add anything. I am now using the Emacs editor in MUTT. Advanced MIME support

MUTT does not directly support the open certain types of accessories as a general Email program. Because there is too much type of accessories, an email client does not have all functions that you can implement yourself. So MUTT provides. Mailcap settings. You can enable your favorite program to open a particular type of attachment. For example, I can let

Lynx helps me turn the letter with the HTML attachment to text in Mutt, I let the imagemagick's Display program help me display pictures ...

Support PGP encryption

MUTT can make PGP encryption and digital signatures for programs such as GNUPG. Others can use your public key to send you a letter that only you can see. You can also use your private key to give the letter "signature", the person who receives the letter can verify that the letter you publish is really you sent.

MUTT is free

Have you listened to so much benefits? Is there anything better than this?

Where is MUTT to find?

MUTT's homepage

http://www.mutt.org/. There are all source programs and documentation above.

Does MUTT have some significant differences with other Email programs?

Mutt is obviously a UNIX mail program, which is different from a general Windows mail program, it is not a loud hodgeppot. You will even find that it doesn't send a message at all, it never edits the email, it never encrypts and digital signing your email ...

MUTT is more like a file manager, but it manages Email. Its function is to be implemented with the most powerful programs. This is in line with UNIX design ideas.

When MUTT needs to edit emails, it is possible to call Emacs, VI, Vim, Pico, ... and other edits.

When MUTT needs to be sent, it puts the letters you need to send in Sendmail, and there is no matter what you do.

When a digital signature is required, MUTT will hand over the letter to the program, and then send it again.

How to collect an email? MUTT will not go to the POP server to remove the email, you need a fetchmail program to help you take the email from the POP server back, forward to your own Sendmail's mailbox. This looks that your host has become a complete UNIX network workstation. Do you feel very trouble? In fact, some PATCH can make MUTT do not depend on these programs, and handle the delivery work. However, it is highly recommended that you use these external programs! You will know the benefits of these things. First, Vim, Sendmail, Fetchmail These programs are programs that have been trusted by thousands of hammer, editing, sending, and collecting emails you absolutely rest assured. Second, you got a function of a UNIX network workstation:

Sendmail can not only help MUTT emails, but also help other UNIX programs such as TIN sending emails. If you need a mail server to help you, then you only need to set up all the programs of all users can automatically send mail, don't have to set the account for each program.

Fetchmail will forward to local Sendmail after receiving the message. Sendmail If you allow .Forward, you can edit a .forward file in your own directory, and letters can be automatically forwarded to else or after filtering. You can write a filter with a language such as Perl, which can achieve a lot of functions according to the content of the letter, such as automatic reply, and more. For example, I wrote a simple filter, which can record all sender's address, if I connect the Helloooo robot to the filter, I am afraid you will receive a cute Helloooo's reply MUTT usage guide.

MUTT usage Similar Vim. Every button is a command, you can set a lot of options in the configuration file ~ / .muttrc to change the behavior of the MUTT. I don't have much time to write a introduction. You can look at Mutt Manual. I only solve some problems that Chinese people often encounter with MUTT.

basic configuration

You first saw that the configuration method said in the MUTT manual may not know what it is. Now I will say some of the necessary configuration you need to start using it.

Alternates

This variable should be set to a regular expression, it is the address you have to receive the letter. For example, I am very simple, there is only one address:

Set alternates = "wang-y01@mails.tsinghua.edu.cn"

This variable helps MUTT display the address characteristics of the message. General MUTT will display several different email address features in Index, which are specified by the $ TO_CHARS variable.

TO_CHARS

Generally $ TO_CHARS is defined as " TCFL".

"(Empty): It is not for you, that is, to: and cc: bcc: no address, many forward mail, unconfirmed mailing list mail, spam has this feature.

: Means you are a recipient (TO: is one of your addresses), and is the only recipient.

T: indicates that you are a recipient (to: including 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 person being copied.

F: means that this email is you sent.

L: It means this is a list of mail you have already added.

Let's see the picture below, it is a list that Mutt has possible appearance. Do you see the address characteristics? The location of the actual address feature appears in the list can be changed. I will see in $ index_format.

Index_Format

This is a format string to control your INDEX list display. Its default definition is:

Set index_format = "% 4C% Z% {% B% D}% -15.15L (% 4L)% s"

This is like this:

There is a simple correspondence,% 4C represents the number of 4 digits, and% z is a mail state. Do you see the "R"? That is, I have already returned this letter. % Z also contains that "T", that is, this letter is not just sending me a person, my father will CC every time I send a letter.

% {% B% D} is a date format, which is defined by the format of the strftime () function. Here% b is the monthly referred to as the current Locale set, "December". % D is the monthly date, "31" represented by decimal. Behind ... you look at MANUAL, I am not awkward.

Mailboxes

Specify that you have those mailbox files. When you press "C" to switch the mailbox, press the TAB button, these mailboxes can choose from.

Mailboxes Mailbox Sent-Mail

HEADER This is a BOOL type variable. It indicates whether you quote the original message header when you are reply.

Set header = no

quit

It can be set to Yes, NO, Ask-Yes, or Ask-no. This is to say, is it prompting you (ask-yes, ask-no), or directly exit (YES), or I don't care about you (NO).

SET quit = ask-yes

Auto_VIEW

What types of accessories are allowed to pass. Mailcap?

Auto_View Text / HTML

Move

This is also a prompt variable. It is determined whether you prompt you to move the letters from the spool from the spool.

SET MOVE = NO

ASCII_Chars

When MUTT is displayed in a Thread mode, the tree list is used to use pure ASCII.

Set ascii_chars = yes

This looks like it is set:

Include

Whether to reply if you contain the original text.

SET INCLUDE

Indent_str

Calling the citation inserted into that symbol?

SETIDENT_STR = ">"

MY_HDR

Set your own email header. For example, I want to let the letter look from

WANG-Y01@mails.tsinghua.edu.cn is sent, not from

Wy@wangyin.com is sent. Because wangyin.com is the host name I set up, not a legitimate domain name for registration. I want others to see my letter is sent from my Tsinghua mailbox, let them reply directly to my Tsinghua mailbox, just do this:

my_hdr from:

Wang-y01@mails.tsinghua.edu.cn

Score

New letters 4 points, Dad (W2R007) 2, the theme contains "notification" 2, the theme contains "Circulation" 3, the deleted -5, the last 1, including " Believe "- 10 (junk advertising!).

Score "~ n" 4

Score "~ f W2R007" 2

Score "~ S Notice" 2

Score "~ s Circulation" 3

Score "~ D" -5

Score "~ o" 1

Score "~ S Believe" -10

Sort

Sort by. May be

date

Date-Sent

Date-Received

From

Mailbox-Order (unsorted)

score

Size

Subject

Threads

TO

Several ways, each way can add a "Reverse-" prefix in front to represent the reverse direction sort. I usually sort by the score:

SET SORT = SCORE

Sort_aux

When you sort by Thread, we have the relative sort order of each Thread.

SET SORT_AUX = Date

Pager_Stop

If you are set, then when you are pages in Pager (in the window of your content), if you turn to the end, then press down to turn to the next letter. If you don't set it, you will be automatically turned to the next letter.

SET PAGER_STOP

FAST_REPLY

If you set it, when you press "R", you will not prompt you to enter the reply address and theme, and enter the editing mode directly.

SET FAST_REPLY

Resolve

When you press the tag operation such as "T" or "D", the cursor is automatically moved to the next letter.

SET resolve = YES

Alias_file

When you use "A" in Index to tap the name of the letter, use which individual name file saves this alias.

Set alias_file = / home / wy / .mutt.Arias

Record

You sent a message to that mailbox file? For example, you can put a letter from me every month in different files.

Set record = "~ / mail / = Sent-mail-`date % y-% m`"

Charset

Which code is supported by your terminal? This must be the same as your terminal encoding.

Set charset = "GB2312"

Send_charset

The character set that can be used when sending a letter. It is only used when the previous character set cannot indicate the content of the letter. For example, if you set it like this, your letters are all in English, then letters will be set to US-ASCII encoding. If there is a french character, then use ISO-8859-1, if there is a Chinese character Will use GB2312, if not, use UTF-8.

SET Send_Charset = "US-ASCII: ISO-8859-1: GB2312: UTF-8"

WAIT_KEY

Whether or not the user is required to return to a button when an external program exits. This is a comparable time when it looks at some shell commands, otherwise they disappear.

SET WAIT_KEY = YES

ConfirMappend

Do you prompt when you want to save your letters to another, and this mailbox already exists?

Set noconfirmappend

Edit_Headers

Do you want to modify the email header in the editor?

Set Edit_Headers = NO

Pager_index_lines

When you use the PAGER to see the letter, how many rows of lines have been left in Index show mailing list?

SET PAGER_INDEX_LINES = 4

For example, I left a list of 4 lines, and the other uses to display the body:

Subscribe

Tell MUTT You have subscribed to Mailing-List. This helps Mutt judges that letters are turning over, avoiding your wrong reply to others' private mailbox. Also avoid others to reply to your private mailbox.

Subscribe

Fvwm@fvwm.org

After that, the TO received: Yes

Fvwm@fvwm.org's letters look like this:

The address front "L" indicates that this is a mailing list. Don't follow the "R" after seeing, you will go back to others' private mailbox. Press "L" to reply to the message list address, here is

Fvwm@fvwm.org.

Mutt Chinese FAQ

Here are some common problems and solutions. Many of the problems I have encountered in some unable to connect abroad, without their own domain names and mail servers.

How can I make me send a letter to use my POP mailbox, not

Root@myhost.com This address?

Use my_hdr to set your from: set to the address you want. For example, I set this:

my_hdr from:

Wang-y01@mails.tsinghua.edu.cn

Pay attention to from: there is a space after the colon!

How to make MUTT display for Chinese?

Why did the letters issued by set local = "zh_cn" set the wrong charSet? Others' procedures don't display my Chinese letters correctly!

Add GB2312 encoding to your seund_charset. Like this best:

SET Send_Charset = "US-ASCII: ISO-8859-1: GB2312: UTF-8"

Received some Chinese letters all displayed as "???"

This is because some Email clients, such as Tsinghua University mails.tsinghua.edu.cn's WWW interface client does not set character encoding, you see the email header (press H), is there a

Content-Type: Text / Plain

But did not say charset = "GB2312"? MUTT encountered this message that did not set up a charset, so if you want this letter to display correctly, set "US-ASCII" to Alias ​​of "GB2312":

Charset-hook ^ US-ASCII $ GB2312

Pay attention to the end of "US-ASCII"!

But there is still an email title garbled!

Look at the messy letters in your $ spool, is it similar to the following:

Subject: =? ISO8859-1? B? U29oddcj09hcvdq587dg09dqwrpj1lg808jro6e =? =

The letters sent by the servers such as chinaren use the quoted-printable Subject, and the encoding is "ISO8859-1", which is obviously wrong.

The way to deal with this mistake is to turn ISO-8859-1 into GB2312 alias:

Charset-hook ^ ISO-8859-1 $ GB2312

Pay attention to the end of "ISO-8859-1"!

If there is still a mess around. Simply use

Charset-hook. * GB2312

Use all letters with GB2312.

However, the Subject issued by the Evolution is garbled for the subscriber of the UTF-8 encoded!

Then map the encoding that is not UTF-8 to GB2312:

Charset-hook! UTF-8 GB2312

How to configure fetchmail?

Fetchmail configuration is very simple. If it is just a person, you can set this: For example, I have edited a .Fetchmailrc in my $ home directory .Fetchmailrc:

Set daemon 60

Poll mails.tsinghua.edu.cn

Protocol POP3

User "wang-y01"

Password "WANG-Y01 password"

Poll smth.org

....

....

Then write fetchmail to my shell boot script:

! PS AUX | Grep -q Fetchmail && Fetchmail &

Fetchmail starts after starting a daemon, each divided into me to check the mail in all mailboxes, collect it, and forward to the local mailbox. Modify the above "60" to change the check interval.

If you don't want Fetchmail to delete files on the server, and take only new letters each time. Just add:

Keep

UIDL

I don't want to use fetchmail, can I directly recover POP letters?

If your MUTT is compiled, you can collect mail directly from the POP server without using Fetchmail. Add similar to these rows to ~ / .muttrcset pop_user = wang-y01

Set pop_pass = "password for wang-y01"

Set pop_host = "pop: //mails.tsinghua.edu.cn"

You can also enter all content at once:

SET POP_HOST = "Pop: // wang-y01: wang-y01 password @ smth.org"

Press "G" in MUTT to take the email.

How to deal with multiple POP3 mailbox?

If you have multiple POP mailboxes, you can set some convenient macros to receive the POP letter in your mailbox. For example, just like me:

Macro Index, SHREDDER ": set pop_host = /

/ "POP: // SHREDDER: SHREDDER password @ Smth.org /" / R /

"

Macro Index, SK8ER ": set pop_host = /

/ "POP: // SK8ER: SK8ER password @ smth.org /" / r /

"

Macro INDEX, TS ": set pop_host = /

/ "POP: // wang-y01: wang-y01 password @Mails.tsinghua.edu.cn /" / r /

"

Macro Index, G ", SHREDDER, SK8ER, TS"

In this way, just press, SHREDDER can collect me on SMREDder letter on smth, as long as the SK8ER can receive the letter on SMTH SK8ER, as long as Press, TS can collect mails.tsinghua.edu.cn letters, As long as you press, G can charge all the letters of all POP mailboxes.

How to access POP3 mailboxes directly?

In addition to the above method, you can also access the POP3 mailbox. For example, I can directly press "C" to switch to the mailbox Pop: // SK8ER: SK8ER password @ Smth.org

You can browse the POP letter. Switch to other mailboxes and browse different POPs. If you are too much button, you can define a macro yourself. This is a synchronous operation, if you delete a letter in this mailbox, MUTT will delete letters on your POP3 server. You don't delete it or you don't delete it.

Too much email is very efficient, every time you have to take all mail heads, just like Foxmail "Remote Mail Management". So it is best to use this when you don't want to retrieve letters, and use this method when you want to delete spam.

How to handle mailing list?

See the subscribe command.

When I press "D", the mail is directly marked and deleted. How can I move the deleted letters to a "garbage box"?

You only need to save your letters to your trash can, such as ~ / mail / trash, letters will be automatically done the "D" (delete) flag. In order to let "D" can be saved to the trash, you can bind the "D" button to a macro. But if you want to delete the email in the trash, this macro will re-store the community of the garbage to the trash can create a loop. So you should use Folder-Hook to restore "D" to the original DELETE-Message function in the trash can, and use that macro in other mailboxes. Now you can get a "trash can" function with the following settings. When you press "D" for the first time, it is possible to be interrogated to establish this mailbox (trash).

Folder-hook. 'macro index d "~ / mail / trash / r"

Folder-hook ~ / mail / trash 'bind index d delete-message'

When the header received by the mail has a lot of projects, my Pager is all email headers. How can I only see some mail head I want to see?

You can ignore the message head you don't want to see by Ignore. If IGNORE *, you can ignore all mail heads. Use unignore to recover the ignored mail header. So a simple way is to ignore all email heads first, then release the few you want to see.

Look at the settings below. Only TO: SUBJECT: DATE: three items is displayed in my SENT. * (Outbox). And in other mailboxes Display from: Subject: X-MAILER: DATE: These items.

Folder-hook. "ignore *; unignore from subject x-mailer date"

Folder-hook Sent. * "ignore *; unignore to subject date"

You can also specify the order of the email header:

HDR_ORDER from To Subject Date

How do Mutt uses an address book?

You can use alias to implement an address book. The form of an alias command is like this, an example:

Alias ​​Wy Wang Yin

Alias ​​is a command, Wy is an alias, Wang Yin is a standard email address. This way, if you press "M" in Index, enter "WY" at TO: prompt, you can send a message to wang yin .

Press TAB to display the contact in Tab, then you can move the cursor to select the contact.

If you have a lot of Alias ​​to write, it is best to write them to another file, such as call .mutt.alias. Then in .muttrc plus:

Source ~ / .mutt.Arias

You can also set a variable:

Set alias_file = ~ / .mutt.Alias

In this way, you can add the letter to this alias file in Index.

How does MUTT handle HTML attachments?

MUTT can handle any type of attachment. Because it can call the appropriate programs to process them. In order to display HTML directly in the MUTT window, you only need to join in ~ / .mailcap file:

Text / html;

Lynx - Dump% S; NameTemplate =% s.html; Copiousoutput is added at ~ / .muttrc Add:

Auto_View Text / HTML

How MUTT handles Word DOC attachments.

Tsinghua University always likes to send a notice containing DOC attachments. It's really ft. There is now a perfect solution: use wvware to convert DOC into HTML embedded in MUTT.

Wvware can be

Http://www.wvware.com/ is free.

wvhtml - Charset = GB2312 Your.doc Your.html

You can turn your DOC to HTML. After testing, it can properly handle Chinese characters and pictures.

You can let Mutt call WVHTML directly display the converted DOC documentation directly in its own window. Join only in ~ / .mailcap file:

Application / MSWORD; WVHTML - Charset = GB2312% s - |

Lynx - DUMP -STDIN;

NameTemplate =% s.html; Copiousoutput

Text / html;

Lynx - DUMP% S; NameTemplate =% S.html; Copiousoutput

Add in ~ / .muttrc:

Auto_View Text / HTML Application / Msword

This way, your mutt is like this:

What should I do if I use Emacs in MUTT?

Emacs is a very powerful editor, so you will definitely hope to use Emacs in MUTT. You can choose two ways:

One way is to use the emacs (Emacs -NW) of the non-graphical interface directly in the terminal of MUTT.

You only need to set it in .muttrc:

Set editor = "emacs -nw"

This will start a new Emacs. If your Emacs configuration joins a lot of expansion, this startup time is quite long, you don't want to wait for each Email waiting for Emacs to start?

There is a way to skip the lengthy Emacs extensions. Just put the part of your .emacs to the part of the time in a conditional statement. For example, I will start the Desktop and Session in a conditional statement. If you know the edited file name called "/ TMP / MUTT -..." then we know that Mutt is calling Emacs, so I don't load Desktop and Session this fee and useless.

(unless

(catch 'Found

(DOLIST (Arg Command-Line-ARGS)

(if (string-match "^ / TMP / MUTT-" arg)

(Throw 'Found T))))))))))))))))))

; Load Desktop

(Load "Desktop")

(Desktop-load-default)

(Desktop-read)

; Load Session

(Require 'session)

(Add-hook 'after-init-hook' session-initialize)

(setq desktop-globals-to-save '(desktop-missing-file-warning))

; Start Server

(Server-start)

)

One way is to send to the EMACS server editing of the GUI using EmacsClient.

This approach can use a startup Emacs to start very fast. But I don't really like this way, because I don't want to leave the MUTT's terminal to Emacs window, edit it to switch the window. Look at this picture. Let's take a look at the Emacs settings. After starting Emacs, you can start the Emacs server using Server-Start. You can also

(Server-start)

Add to your .emacs file, so that the server is started automatically when Emacs starts.

Join in .muttrc

Set editor = emacsclient

This way MUTT will send something you need to edit to Emacs that you need to edit when you want to send an email. After editing, you press C-X #, and the control will turn back to MUTT.

I can't connect directly, sendmail must be forwarded through mails.tsinghua.edu.cn, but Sendmail can't be verified by ESMTP?

Due to the restrictions on the Tsinghua University Network Center, the general classmates cannot directly connect abroad. This way Sendmail cannot directly send mail to the destination. We need to rely on domestic mail servers to forward them to your destination. But now China's SMTP mail server usually requires SMTP verification to help you forward mail. For example, mails.tsinghua.edu.cn, this is a way to prevent others from using their hosts to send spam.

How can Sendmail authenticate via SMTP? Sendmail's webpage said there is a way. But I still didn't get it for a day. And Sendmail is known in the security vulnerability. So I decided to exchange for postfix. Qmail is also very good, but I don't know how to make qmail forwarded through Auth SMTP. If someone knows, please tell me.

Postfix is ​​a mail server that can replace Sendmail. It can achieve three times the throughput rate of SENDMail on ordinary machines. And quite safe. It can

Www.postfix.org Download and installation process is as follows:

When you compile, you need to let Postfix support SASL verification, compile with the following options:

% make makefiles ccargs = "- duse_sasl_auth -i / usr / local / incrude" /

AUXLIBS = "- l / usr / local / lib -lsasl"

Then install

% make; Make Install

For Postfix, you can send local emails correctly, please add: in /etc/postfix/main.cf:

myhostname = Tu140066.tsinghua.edu.cn

MyDestination = WANGYIN.COM, $ MyHostName, Localhost. $ MyDomain

$ myHostName indicates your host domain name, Tsinghua University's network gives everyone a domain name, in fact, tuxxxxx.tsinghua.edu.cn, xxxxxx is the number behind your IP, such as my IP is 166.111.140.66, so I The domain name is Tu140066.tsinghua.edu.cn.

$ myDestination pointing out which addresses are thinking that your own address. You should put your machine name (my is wangyin.com), $ MyHostName, $ localhost. $ Mydomain.

In order to be able to verify the login using SASL, add these lines to /etc/postfix/main.cf

SMTP_SASL_AUTH_ENABLE = YES

SMTP_SASL_Password_maps = Hash: / etc / postfix / sasl_passwd

SMTP_SASL_SECURITY_OPTIONS = #LEFT EMPTY to ALLOW LOGIN MECHANISMRELAYHOST = mails.tsinghua.edu.cn #change this to your reference host

Edit Password / etc / postfix / sasl_passwd. Join one line:

Your.relay.server your_auth_login_name: Your_password

For example, my password file is like this:

Mails.tsinghua.edu.cn wang-y01: ADF2M @ 3D $ =

Of course, the password is not that: P

Turn the password file to Berkeley DB format:

#postmap hash: sasl_passwd

Start your postfix server

Postfix Start

转载请注明原文地址:https://www.9cbs.com/read-68283.html

New Post(0)