在linux中使用mailx发送邮件


 

[root@ml ~]# yum -y install mailx   #安装

[root@ml ~]# vim /etc/mail.rc    

在最后一行添加(我这里使用的是qq邮箱):

set from=664268***@qq.com  #来自  
set smtp=smtp.qq.com #qq的smtp邮箱
set smtp-auth-user=664268***@qq.com #账号
set smtp-auth-password=wzkwaotbwples***  #授权码(下图教怎么在q邮箱获取)
set smtp-auth=login #认证方式,可以是ssl,默认是login

 

 选择账户,然后往下滑。

 

 测试:

  [root@ml ~]# echo "你好" | mailx -s "meml" memlkk@163.com 

 使用465

 

mkdir -p /root/.certs/
echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/qq.crt
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
certutil -L -d /root/.certs

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM