在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