TSL configured to send mail mailx

TSL configured to send mail mailx

If you need to apply for unblocking the cloud server port 25

Into the title:

First, the configuration using the SMTP mail mailx:
1, the installation mailx; directly yum install mailx -y herein can be installed;
2, /etc/mail.rc in the configuration file, the following entries in the final surface:

. 1 SET = from " [email protected] " 
2 SET = SMTP smtp.qq.com
 . 3 SET = User-SMTP the auth- XXX
 . 4 SET = SMTP-mail the auth-password authorization code #qq Mailbox -> Settings -> Account
 5 the auth = SMTP-SET Login

Configuration is very simple, there is not much to say, there are two points to note:

E-mail need to open the SMTP function, open the mailbox of each method are similar;
now most use SMTP mail will let you start an authorization code to replace the mailbox password
specific individual mailboxes open the way authorization code can be directly Baidu;
Second, obtain a certificate

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

You can return the following tips:

  1. **Notice: Trust flag u is set automatically if the private key is present.**

According to the above operation, as long as no error is normal, we will see several certificate file in /root/.certs Next, the operation was successful; as to why

To do this, do not ask me, I am also a big God COPY approach;

Certificate configuration Well, here we're going to configure mail.rc configuration files, and the beginning of a different, here we need to configure and TSL related things

set from=[email protected]
set smtp=smtps://smtp.qq.com:465
set smtp-auth-user=[email protected]
the SMTP the SET -auth-password = your authorization code
set smtp-auth=login
set smtp-use-starttls 
set ssl-verify=ignore
set nss-config-dir=/root/.certs

So far, the combination has been completed mailx QQ mailbox to send mail systems deployed by the command line to send test messages Try it:

1  echo  " test mail " | mail -s " test "   [email protected]

 Three sending mail

1  echo  " here Enter your e-mail content " | mailx -s " message header " -a File .txt [email protected]
 2 mail -s " message header " -a File .txt [email protected] <   message.txt
 3 - S title
 4 -a accessories

 

 

 

Guess you like

Origin www.cnblogs.com/doufy/p/11014778.html