ECS centos7 使用外部邮件服务商的465加密端口
ECS centos7 使用外部邮件服务商的465加密端口发送邮件。
1.修改/etc/mail.rc 文件中添加以下的
set smtp="smtps://smtp.163.com:465"
set smtp-auth=login
set smtp-auth-user="xxxx@163.com"
set smtp-auth-password="xxxx"
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb
2.保存重启sendmail 服务器
3.测试发送
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #!/bin/bash 2 #Date: 2018-08-13 3 #Author:Zoulixiang 4 #Email: zoulixiangxzt@163.com 5 6 NGX_status=`netstat -anpt |grep "nginx" |grep -v "grep" |wc -l` 7 8 Mysql_status=`ps -aux |grep mysql |grep -v grep |wc -l` 9 10 Date_time=`date +%Y%m%d%H%M` 11 12 ###############nginx_status####################### 13 if [ $NGX_status -ne 0 ];then 14 15 echo "Nginx is running " 16 echo "nginx Service not started_$Date_time" >> /var/mail/server_err.log 17 18 fi 19 20 21 ###############php_status########################### 22 if [ $PHP_status -ne 0 ];then 23 24 echo "php is running " 25 else 26 echo "php Service not started" 27 echo -e "故障消息\n 主机:web \n IP:xxx\n 监控项:PHP_status\n 触发器:PHP Service not started\n 时间:date_$Date_time\n " | mail -v -r "XXXX@163.com" -s "PHP_status" XXXX@163.com 28 fi 29 30 ##############Mysql_status######################### 31 if [ $Mysql_status -ne 0 ];then 32 33 echo "Mysql is running " 34 else 35 echo "Mysql Service not started_$Date_time" 36 echo -e "故障消息\n 主机:web \n IP:XXXX\n 监控项:Mysql_status\n 触发器:Mysql Service not started\n 时间:date_$Date_time\n " | mail -v -r "XXX@163.com" -s "Mysql_status" XXXX@163.com 37 fi
4.效果图