1、sendemail 安装
yum install -y sendemail
2、查看sendemail参数命令
/usr/bin/sendemail --help
4、注意点:需要开启IMAP/SMTP服务(这里是QQ邮箱)链接如下
https://service.mail.qq.com/cgi-bin/help?subtype=1&no=166&id=28
3、编写shell脚本(密码是开通服务获取)
vim sendemail.sh
#!/bin/bash
#script name : sendemail.sh
account='xxx@qq.com'
password='123456'
to=$1
subject=$2
content=$3
sendemail -o tls=yes -s "smtp.qq.com:587" -f $account -t $to -u $subject -o messa