yum install mailx -y
vi /etc/mail.rc
直接在后面追加下面内容,这里用的腾讯企业邮箱ssh
set smtp=smtps://smtp.exmail.qq.com:465 set smtp-auth=login set smtp-auth-user=xxx@xxx.org set smtp-auth-password=oProxS3cVbJxxxx set from=xxx@xxx.org set ssl-verify=ignore set nss-config-dir=/etc/pki/nssdb/
smtp是邮箱的smtp地址,如今基本都是用ssl,能够在邮箱设置里看到ide
smtp-auth是认证方式测试
smtp-auth-user是用户名,也就是你的发信人邮箱号this
smtp-auth-password是口令,用邮箱里生成的受权码blog
from是发件人地址,也是你的邮箱号教程
下面的两项是配置ssl用的,最后一项的证书目录路径须要用下面搜索,默认通常都是这个地址ssl
find / -name "cert*.db"
用下面的命令测试发邮件功能,这里是本身发给本身it
echo "this is my test mail" | mail -s 'mail test' xxx@xxx.org
发出后会有个提示,大概意思是 “证书错误:没法识别对等方的证书颁发者。”class
腾讯企业邮箱在设置-邮箱绑定里test
以前一直用网上搜到的教程作,都不成功,邮件没法发出,也无回显
以前的/etc/mail.rc的配置文件是这样的
set smtp=smtp.exmail.qq.com set smtp-auth=login set smtp-auth-user=xxx@xxx.org set smtp-auth-password=oProxS3cVbJxxxx set from=xxx@xxx.org
后来在这篇文章里看到后想到多是ssl的问题,才有了前面的新配置