Install and configure in centos6 and use mutt + msmtp to send mail

Time:2021-1-16

In CentOS system, if you want to send mail to foreign domain, you need to configure sendmail + dovecot and other tools. In fact, it doesn’t need to be so troublesome, as long as mutt + msmtp can realize the function of sending e-mail to foreign domains.

This paper is based on centos6 64bit

1. Install and configure msmtp

Copy code

The code is as follows:

$ yum install gcc gcc-c++ gnutls gnutls-devel gnutls-utils openssl openssl-devel libidn libidn-devel -y
$ wget http://sourceforge.net/projects/msmtp/files/msmtp/1.4.32/msmtp-1.4.32.tar.bz2
$ tar -jxvf msmtp-1.4.32.tar.bz2
$ cd msmtp-1.4.32
$ ./configure –prefix=/usr/local/msmtp
$ cd msmtp-1.4.32
$ make && make install</p>
<p>$ mdkir /usr/local/msmtp/etc

Generate configuration file

Copy code

The code is as follows:

$ cat >>/usr/local/msmtp/etc/msmtprc<<EOF

Directly copy the following content and paste it in the position of the > sign

Copy code

The code is as follows:

defaults
tls on
logfile /usr/local/msmtp/msmtp.log</p>
<p>account acc1
host smtp.163.com
port 25
from [email protected]
auth login
tls off
user [email protected]
password mypasswd</p>
<p>account acc2
host smtp.qq.com
port 465
from [email protected]
auth login
tls_starttls off
tls on
tls_certcheck off
user [email protected]
password mypasswd</p>
<p>account default : acc2
EOF

There are some things to pay attention to in the configuration file:

QQ mailbox does not support TLS, so you need to close TLS when using QQ mailbox_ starttls,

The SSL certificate of Netease free mailbox can not pass the verification, so when using 163 mailbox, only TLS certificate verification can be turned off.

The configuration file does not support Chinese and cannot paste Chinese comments, otherwise an error will be reported.

2. Install and configure mutt

Copy code

The code is as follows:

$ yum install mutt -y
$ cat >>/etc/Muttrc<<EOF

Directly copy the following content and paste it in the position of the > sign

Copy code

The code is as follows:

set sendmail=”/usr/local/msmtp/bin/msmtp”
set use_from=no
set realname=”[email protected]
set editor=”vim”
EOF

3. Function test

Copy code

The code is as follows:

$echo “here is the text” | mutt – s “here is the title” [email protected]

No accident, we should be able to receive the mail. If there is no response after 5 seconds, the default account configuration in the msmtprc file is incorrect. You can first execute PS – EF | grep mutt to find out the process number kill, and then modify the relevant configuration in the msmtprc file and try again.

Recommended Today

Re learn JavaScript of front end (3) scope, prototype chain, garbage collection mechanism, closure, event execution sequence

This article mainly introduces the scope, prototype chain, garbage collection mechanism, closure and event execution sequence in JavaScript Execution environment and scope 1execution environment The definition of  execution environment : The execution environment defines other data that a variable or function has access to , It determines their respective behaviors. Each execution environment has a variable […]