mailx加163邮箱发邮件

mailx加163邮箱发邮件

参考:https://www.cnblogs.com/myvic/p/9579954.html

配置

$ yum install mailx -y
$ vim /etc/mail.rc
set from=m17114517139_2@163.com
set smtp=smtps://smtp.163.com:465  
set smtp-auth-user=m17114517139_2@163.com
set smtp-auth-password=zhj6b266
set smtp-auth=login
set nss-config-dir=/root/.certs
set ssl-verify=ignore
$ mkdir -p /root/.certs/
$ echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA
verify return:1
depth=1 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = GeoTrust RSA CA 2018
verify return:1
depth=0 C = CN, ST = Zhejiang, L = Hangzhou, O = "NetEase (Hangzhou) Network Co.,Ltd", OU = Game Dep., CN = *.163.com
verify return:1
DONE
$ certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt
$ certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt
$ certutil -L -d /root/.certs

Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI

GeoTrust SSL CA                                              C,,  
$ cd /root/.certs/
$ certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i 163.crt
Notice: Trust flag u is set automatically if the private key is present.

测试

$ cat test.txt 
  If we can only encounter each other rather than stay with each other,then I wish we had never encountered.
  No man or woman is worth your tears, and the one who is, won’t make you cry.
$ cat test.txt | mail -s 'test email' haha@spam4.me

原文地址:https://www.cnblogs.com/uscWIFI/p/11830129.html