Settings for sending emails from WordPress under the cloud server

The email function of WordPress is very powerful, and it can realize self-recovery of user passwords in the future and other issues.

WordPress uses php to send emails by default, and php needs to be configured with smtp (port 25) server and password. This method is not intuitive, so the smtp plugin is generally used, and the commonly used plugin is WP Mail SMTP.

It can provide a variety of mailbox connections (mainly abroad, domestic ones can choose other)

 

The default is the state before installing the plug-in, which is to send emails with PHP functions. Even if the default option is still used, this plugin can be used to test sending emails.

The above is the email sending setting part of WordPress, but if you need to successfully send out emails, you need external environment support, these include:

1. Use self-built mail system

2. Use a third-party mail system

The self-built mail system is relatively complicated, and requires domain name analysis and installation of mail service software. This period is easy to handle, but when the mail system is set up, many ports need to be opened, such as: 25, 110, 995, 465, 587, etc., the most important is 25, which needs to be applied in Alibaba Cloud, because of security reasons, this port is defaulted is not enabled.

 Many netizens said that the application pass rate is not high. Therefore, you can only choose corporate mailboxes or third-party mailboxes. Let's take the 126 mailbox as an example to complete the email sending settings of WordPress.

1. Enter the 126 mailbox and open the POP3/SMTP service. You need to scan the code to send SMS with the registered mobile phone number. Be sure to save the authorization password

 

 

2. Enter the terminal and enter the following commands in sequence:

mkdir -p /root/.certs/

echo -n | openssl s_client -connect smtp.126.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/126.crt

certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/126.crt

certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/126.crt

certutil -A -n '126' -t "P,P,P"-d /root/.certs -i ~/.certs/126.crt

certutil -L -d /root/.certs

vi /etc/mail.rc Add the following content at the end of the file:

et [email protected]

set smtp=smtps://smtp.126.com:465

set [email protected]

set smtp-auth-password=Authorization password

set smtp-auth=login

set ssl-verify=strict

set nss-config-dir=/root/.certs

3. Test:

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

At this time, the mailbox can receive a text message

4. Configure the WordPress plugin WP Mail SMTP (the installation process is omitted)

Choose another type of mailbox

 

 

 

 5. Email test

 

 

 At this point, the WordPress email sending settings are complete. After the setting is successful, you can add a user, test "send password reset email", and modify the user password by mail.

 

Guess you like

Origin blog.csdn.net/dgnankai/article/details/131654404