Centos install mailx mail service set smtp to send mail

Install mail service:

 [root@node2 ~]# yum -y install mailx 

Add the email address information at the end of the configuration file:

 [root@node2 ~]# vim /etc/mail.rc 

Netease mailbox:

set from=xxxxxxx@163.com 邮箱地址
set smtp=smtp.163.com 为邮件服务器
set smtp-auth-user=xxxxxxx@163.com 邮箱用户名
set smtp-auth-password=XXXXXXXX 邮箱密码,由于163邮箱需要设置授权,此处需要填写授权密码
set smtp-auth=login

test:

 [root@node2 ~]# echo "hello zabbix " | mail -s "liudonghui_zabbix-install" xxxxxxx@163.com

Mail format: echo "mail content" | mail -s "mail subject" recipient's email address

Insert picture description here

NetEase mailbox opens POP3/SMTP/IMAP service:

Insert picture description here
Insert picture description here

Tencent mailbox:

set from=xxxxxxxx@qq.com
set smtp=smtp.qq.com
set smtp-auth-user=xxxxxxxx@qq.com
set smtp-auth-password=邮箱密码 此处密码均为客户端授权码第三方登录的密码
set smtp-auth=login

test:

 [root@node2 ~]#  echo "hello aihuidi" | mail -s "测试 Linux check " xxxxxx@qq.com

Insert picture description here

Tencent mailbox opens POP3/SMTP/IMAP service:
Insert picture description here

Swipe down the page and you will see the information for setting POP3/SMTP/IMTP

Insert picture description here

Guess you like

Origin blog.csdn.net/ichen820/article/details/115252802