Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The daily knot installation in the Linux system configures Mutt as a Gmail client.

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the "Linux system daily knot installation configuration Mutt as a Gmail client", in the daily operation, I believe that many people in the Linux system daily knot installation configuration Mutt as Gmail client problems have doubts, Xiaobian consulted all kinds of information, sorted out a simple and easy to use method of operation, hope to answer the "Linux system daily knot installation configuration Mutt to serve as a Gmail client" doubt! Next, please follow the editor to study!

Mutt is a famous mail client under the Linux terminal. As you would like, mutt is a mail client. There are no other flashy features, it can help you improve efficiency, as to help you install X is only a special bonus to mutt.

Because mutt is a program with unix philosophy, it is highly customizable, and its advanced functions can be accomplished by different programs, such as the following:

1.mutt

The easiest way to use mutt's built-in imap,pop,smtp support is to install only the mutt package.

2.mutt + msmtp

The simplest combination, combined with imap, can meet the needs of most people.

The smtp function is implemented by msmtp, and you can even implement the imap function by other software.

3.mutt + msmtp + getmail + procmail

In a slightly more complex combination, mutt is the client, msmtp is used as mta,getmail to receive email, and procmail filters email.

Mta can also be replaced by exim4 or postfix, which is usually enough with msmtp, because postfix is so good that mail servers usually choose postfix.

Msmtp can be replaced by esmtp.

The mail collection function can also use fetchmail instead of getmail. Since local mta delivery is required, procmail is also required.

Procmail is a powerful email filtering system. Ps: when you see this sentence, you should understand that I obviously didn't use it.

Is there any significant difference between Mutt and other email programs?

Mutt is a mail program originating from Unix. Unlike ordinary Windows mail programs, it is not a hodgepodge of everything. You may even find that it doesn't send e-mails directly, it never edits its own emails, it never encrypts or digitally signs emails by itself.

Mutt is more like a file manager, except that it manages email. Its function is realized with the help of the most powerful programs. This is in line with the design idea of UNIX.

When Mutt needs to edit mail, it may call vi, VIM, emacs, pico,... Wait for the editor.

When Mutt needs to send letters, it puts the letters it needs to send into the queue of sendmail and doesn't care about anything.

When a digital signature is needed, Mutt will send the letter to a program such as GnuPG for processing before sending it out.

How do I get the mail? Mutt will not go to the POP server to get the mail, you need a fetchmail program to help you retrieve the email from the POP server and forward it to your own sendmail mailbox. It looks like your host has become a complete UNIX network workstation.

Do you think it's troublesome? In fact, some patch can enable Mutt not to rely on these programs and handle the sending and receiving work on its own. However, it is strongly recommended that you use these external programs! Then you will know the benefits of these things. First of all, VIM, sendmail, fetchmail these programs are well-honed quality reliable programs, use them to edit, send, receive email you absolutely rest assured. Second, you get the function of a UNIX network workstation:

Sendmail can send emails not only for Mutt, but also for other Unix programs such as tin. If you need a mail server to transfer you, you only need to set it up once so that all such programs for all users can automatically send emails, without having to set up accounts for every program.

After receiving the email, fetchmail will forward it to the local sendmail. If sendmail allows .forward, you can edit a .forward file in your own directory, and messages can be automatically forwarded elsewhere or filtered by a filter. You can write a filter in perl and other languages, which can achieve many functions according to the content of the message, such as automatic reply and so on. For example, I wrote a simple filter that records the addresses of all senders. If I connect the helloooo robot to the filter, I'm afraid you'll get a reply from the lovely helloooo:)

Mutt as a Gmail client

As Gmail server-side spam filtering has been done very well, and I use the imap protocol, so there is no need for getmail to receive email, and there is no need to configure procmail's filtering system.

This article explains the configuration of mutt + msmtp.

1. Install mutt and msmtp

General distribution

Mutt and msmtp are already included in the software sources of most distributions, installed directly using the package manager, other distributions, and so on:

The code is as follows:

$sudo apt-get insatll mutt msmtp # applies to the debian system

$sudo yum insatll mutt msmtp # applies to the red hat system

Install under Gentoo Linux

The code is as follows:

$echo "mail-client/mutt-berkdb gpg imap mbox nntp sasl sidebar slang smime smtp" > > / etc/portage/package.use # set the use flag of mutt

$echo "mail-mta/msmtp sasl" > > / etc/portage/package.use # set the use flag of msmtp

$emerge-av mutt msmtp # install mutt and msmtp

two。 Configure mutt

Create and edit ~ / .muttrc

Replace username with your Gmail user name and passwd with your password

The code is as follows:

# set the sending address and user name

Set from = "username@gmail.com"

Set realname = "username"

Set use_from = yes

The code is as follows:

# set Gmail account and password

Set imap_user = "username@gmail.com"

Set imap_pass = "your password"

The code is as follows:

# set remote server folder

Set folder = "imaps://imap.gmail.com:993"

Set spoolfile = "+ INBOX"

Mailboxes = + INBOX

Set postponed = "+ [Gmail] / Drafts"

The code is as follows:

# allow mutt to automatically create a new imap connection

Unset imap_passive

The code is as follows:

# imap connection retention time

Set imap_keepalive = 300

The code is as follows:

# check the interval between new messages

Set mail_check = 120

The code is as follows:

# Local cache directory

Set header_cache = ~ / .mutt/cache/headers

Set message_cachedir = ~ / .mutt/cache/bodies

The code is as follows:

# set TLS verification

Set certificate_file = / etc/ssl/certs/ca-certificates.crt

The code is as follows:

# set built-in smtp, which we don't use here

# set smtp_url = "smtps://username@gmail.com@smtp.gmail.com:465/"

# set smtp_pass = "your password"

# set ssl_starttls = yes

The code is as follows:

# using msmtp

Set sendmail = "/ usr/bin/msmtp"

The code is as follows:

# do not save sent messages

Unset record

The code is as follows:

# reply does not contain headers

Set header = no

The code is as follows:

# exit reminder

Set quit = ask-yes

The code is as follows:

# reply contains the original text

Set include

The code is as follows:

# set the caret before the reply citation

Set indent_str = ">"

The code is as follows:

# set headers

My_hdr From: username@gmail.com

The code is as follows:

# email scoring

Score "~ N" + 4

Score "~ s Notification" + 2

Score "~ D"-5

Score "~ O" + 1

Score "~ s believe"-10

The code is as follows:

# sort method

Set sort = score

The code is as follows:

# second-level sorting

Set sort_aux = date

The code is as follows:

# turn to the last page and don't go back to the first page

Set pager_stop

The code is as follows:

# Quick reply

Set fast_reply

The code is as follows:

# delete messages and automatically move the cursor

Set resolve = yes

The code is as follows:

# set the code to keep it consistent with the terminal

Set charset = "utf-8"

The code is as follows:

# character set used for sending messages

Set send_charset = "us-ascii:iso-8859-1:gb18030:utf-8"

The code is as follows:

# whether to edit the header

Set edit_headers = no

The code is as follows:

# pager displays the number of rows

Set pager_index_lines = 4

The code is as follows:

# tell mutt which mailing lists are

Subscribe ustc_lug@googlegroups.com

Subscribe shlug@googlegroups.com

Subscribe gentoo-user@lists.gentoo.org

The code is as follows:

# using the solarized color scheme

Source ~ / .mutt / mutt-colors-solarized/mutt-colors-solarized-dark-256.muttrc

Save and exit after editing.

Modify the permissions of ~ / .muttrc

The code is as follows:

$chmod 700 ~ / .muttrc

Create a local folder

The code is as follows:

$mkdir-p ~ / .mutt/cache

3. Configure msmtp

Create or modify ~ / .msmtprc

The code is as follows:

# Accounts will inherit settings from this section

Defaults

Auth on

Tls on

Tls_trust_file / usr/share/ca-certificates/mozilla/Thawte_Premium_Server_CA.crt

Logfile / .mutt/msmtp.log

The code is as follows:

# Gmail account

Account gmail

Host smtp.gmail.com

Port 465

From username@gmail.com

User username@gmail.com

Password password

Tls_starttls off

Tls_trust_file / etc/ssl/certs/ca-certificates.crt

The code is as follows:

# set default account

Account default: gmail

Save exit and set permissions

The code is as follows:

$chmod 600 ~ / .msmtprc

4. Configure mutt to use the solarized color scheme

The code is as follows:

$git clone https://github.com/altercation/mutt-colors-solarized.git ~ / .mutt/mutt-colors-solarized

Then modify the configuration in ~ / .muttrc.

When the job is done, the terminal starts:

The code is as follows:

$mutt

Without exception, you will see:

Matters needing attention

Gmail enables two-step authentication that requires an application-specific password for mutt settings

At this point, the study on "configuring Mutt as a Gmail client in the installation of Mutt in the Linux system" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report