Linux can send mail to each other directly from mail, but this kind of mail is easy to be intercepted by QQ mailbox or other mailbox
Therefore, you must send the email to the designated account to not intercept it.
MSMTP is an SMTP client.
By default, it sends the message to the SMTP server responsible for sending the message
Installing MSMTP
Download the latest version
Http://iweb.dl.sourceforge.net/project/msmtp/msmtp/1.6.3/msmtp-1.6.3.tar.xz
Tar xvf msmtp-1.6.3.tar.xz-c/usr/src
cd/usr/src/msmtp-1.6.3
./configure--PREFIX=/USR/LOCAL/MSMTP
Make
Make install
Create a soft link
Ln-s/USR/LOCAL/MSMTP/BIN/MSMTP/USR/BIN/MSMTP
To create a configuration file directory
Mkdir/usr/local/msmtp/etc
Editing a configuration file
Vim/usr/local/msmtp/etc/msmtprc
The contents are as follows:
Mainly modify the red part
# Set default values for all following accounts.
Defaults
Logfile/var/log/msmtp/msmtp.log
# The SMTP server of the provider.
Account QMS
# SMTP mail server address
Host Smtp.qq.com
# e-Mail Email
From [email protected]
Auth Login
# Mail Server login account
User [email protected]
# Mail Server login password
password [email protected]
# Set a default account
Account default: a
Test MSMTP configuration, send to each other
MSMTP [email protected]
Enter Test
Then press CTRL + C to end
Login 163 e-mail, you will receive an empty message, indicating success.
Mutt is a text-based mail client that requires a sending program, which is the MSMTP
Installing Mutt
Yum Install-y Mutt
Create a default log directory
mkdir/var/log/msmtp/
Editing a configuration file
Vim/etc/muttrc
The 2nd line adds the blue part, the red part needs to be modified, the effect is as follows:
# attributes when using a mono terminal
#mono Header underline ^ (from| Subject):
Mono quoted Bold
Set sendmail= '/usr/bin/msmtp '
Set Use_from=yes
Set realname= ' server alarm '
Set from=[email protected] Envelope_from=yes
Auto_view text/html
Set charset= ' Utf-8 '
Set send_charset= ' Utf-8 '
Set locale = ' ZH_CN. UTF-8 '
Set content_type = ' Text/html\;charset=utf-8 '
Set Rfc2047_parameters=yes
Source/etc/muttrc.local
Test send a copy of the message
echo "Testing" |mutt-s "test" [email protected]
Login 163 Email
will receive a letter
The topic is: Server alarm
The content is: testing test
of mail
This allows the shell script to call it to send the message.
This article is from the "Falling Star" blog, make sure to keep this source http://xiao987334176.blog.51cto.com/2202382/1736829
Linux uses MSMTP login to send mail to designated account