Akemi

使用mailx发送到企业邮箱

2024/08/13

首先需要申请一个企业邮箱,如163邮箱

设置开启SMTP协议,获得一个授权码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
yum -y install mailx

vim ~/.mailrc

set from=alertwarning@163.com #发送的邮箱
set smtp=smtp.163.com:25 #使用的协议
set smtp-auth-user=alertwarning@163.com #邮箱账号
set smtp-auth-password=xxx #邮箱授权码
set smtp-auth=login #自动登录
set ssl-verify-server-cert=no #不使用SSL证书

测试
echo "cpu占用率异常" | mail -s "异常告警" alertwarning@163.com
也可以将其写入脚本中

CATALOG