Use mail to send emails in centos7
Modify the configuration file and configure mail-related content (append to the end of the configuration file)
[[Email protected] ~] # Vi/etc/mail. RC
Set [email protected]
Set SMTP = smtp.qq.com
Set [email protected]
Set SMTP-auth-Password = Password
Set SMTP-auth = Login
Set SMTP-Port = 587
Test
Echo "Hello, world" | mail-s "Ceshi" [email protected]
If the operation fails, perform the following operations:
First, check whether the related services are installed.
[[Email protected] ~] # Rpm-Qa | grep mail
Libreport-plugin-mailx-2.0.9-19.el6.x86_64
Mailx-12.4-7.el6.x86_64
Procmail-3.22-25.1.el6.x86_64
Mailcap-2.1.31-2.el6.noarch
Sendmail-8.14.4-8.el6.x86_64
If the service is not installed, run the following command to install the service:
[[Email protected] ~] # Yum install sendmail
[[Email protected] ~] # Yum install mailx-y
[[Email protected] ~] # Yum update libreport-plugin-mailx
[[Email protected] ~] # Yum-y install sharutils
[[Email protected] ~] # Yum install mutt
Configure the email server in centos