How to use Tencent mailbox to send emails under Linux
1. First install sendmail.mailx;
yum -y install sendmail
yum install mailx -y
Set up to start automatically
/etc/init.d/sendmail start
chkconfig sendmail on
测试:echo "this is my test mail" | mail -s 'mail test' [email protected]
2. How to SSL
send emails
Modify /etc/mail.rc to add the following configuration about SSL
set nss-config-dir=/etc/ssl/certs
set smtp-user-starttls
set ssl-verify=ignore
修改 set smtp=smtps://xxxx.xxxx:465
Add Firefox browser *.db files (cert8.db, key3.db, secmod.db) to the /etc/mail.rc_ssl.crt or /etc/ssl/certs directory to send emails in a way that supports SSL, as shown in the figure below Show:
The three dbs store certificates, public keys, and private keys
cert8.db,key3.db,secmod.db
These 3 db files are extracted from firefox, and the extraction method is as follows:
If Firefox is installed on your computer, Windows can get *.db files in %userProfile%\AppData\Roaming\Mozilla\Firefox\Profiles\xxx.default, Linux in ~/.mozilla/firefox/xxx.default directory, or Download directly from this class: https://dn-zhangguoli.qbox.me/mail.rc_ssl.crt.zip
This directory %userProfile%\AppData\Roaming\Mozilla\Firefox\Profiles\xxx.default under the window is a hidden attribute, which needs to be set to show and hide first;
3. Configure mail.rc
vi /etc/mail.rc
set smtp-use-starttls #enable ssl encryption
set ssl-verify=ignore
set nss-config-dir=/etc/ssl/certs #ssl encryption certificate
set smtp=smtp.qq.com
set smtp-auth-password=XXXXX
set smtp-auth=login
set nss-config-dir=/root/.vnetoo_certs/
:wq!
as the picture shows:
4. Execute the command in the text of createvnetoocert.txt
mkdir /root/.vnetoo_certs/
echo -n | openssl s_client -connect smtp.exmail.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.vnetoo_certs/vnetoo.crt
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.vnetoo_certs -i ~/.vnetoo_certs/vnetoo.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.vnetoo_certs -i ~/.vnetoo_certs/vnetoo.crt
certutil -L -d /root/.vnetoo_certs
cd /root/.vnetoo_certs
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i vnetoo.crt
vim /etc/mail.rc
set nss-config-dir=/root/.vnetoo_certs/
5. Bind your WeChat and activate the Tencent Email client authorization code
Remarks: 1. The files used above do not need to be modified except mail.rc which needs to be modified to your own account and password;
2. Reference link for this article:
https://zhangguoli.cn/centos-sends-mail-in-the-way-mailx-uses-external-smtp-ssl.html
https://baijiahao.baidu.com/s?id=1587401158046300905&wfr=spider&for=pc