First, install mailx sendmail
1.1 check whether they have installed
yum install -y mailx sendmail
If you have installed, you will be prompted already installed, not installed automatically installed.
Second, open the sendmail service
View status: systemctl status sendmail
If Active: display active (running) is normal, then start the service if it is dead
Start: systemctl start sendmail
Third, configure the service /etc/mall.rc, for example to the mailbox qq
SET from = [email protected] SET SMTP = smtp.qq.com SET SMTP -auth = User- [email protected] SET SMTP -auth-password = nibpgbkksmlbbabe # not qq mailbox password, is generated in the mail settings qq Authorization code
Fourth, send e-mail
4.1 pipe character:
echo "mail test info" | mail -s "mail_test" [email protected]
4.2 file contents as message content:
mail -s "mail_test" [email protected] < /tmp/t.txt
Five, QQ authorization code generation