CENTOS 使用 MAILX 发送SMTP邮件

安装mailx,如果安装了会有提示

yum  install -y mailx

配置smtp

vi /etc/mail.rc

# 添加 QQ 邮箱 SMTP
set from=534x142@qq.com  #发送邮箱
set smtp=smtp.qq.com    #SMTP服务器
set smtp-auth-user=534x142  #发送帐号
set smtp-auth-password=mailBoxPassword  #授权密码,需要开启pop3/smtp服务
set smtp-auth=login     #授权方式

测试

cat  /tmp/mail.log | mailx -v -s "test" 1343652445@qq.com

搞了好久还是出现下面的错误

Resolving host smtp.qq.com . . . done.
Connecting to 14.18.245.164 . . .Connecting to 14.18.245.164 . . .Connecting to 14.17.57.241 . . .could not connect: Connection timed out
"/root/dead.letter" 11/304
. . . message not sent.
could not connect: Connection timed out
"/root/dead.letter" 11/304
. . . message not sent.

悲催!!!

在配置文件中添加ssl证书

set smtp-use-starttls
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb/
0 条评论
发表一条评论