Windows hosts cannot support the mail () function, so they cannot use the mailbox service provided by WordPress. The mail sending function is essential for a website, for webmasters who use WordPress to build websites, in addition to sending emails using the host email function, you can also use the WP plug-in or directly modify the WP code to implement the email sending function on the WP website.
Next we will discuss how to use the SMTP plug-in of WP and modify the WP code to implement the Mail sending function.
1. Use the SMTP plug-in of WP to implement the Mail function
The SMTP plug-in of WP is made by Chinese people, and the setting interface is very simple. It is a Chinese plug-in.
The wp smtp plug-in has been officially indexed by WordPress and comes with a simplified Chinese package, and can be automatically deleted when uninstalling it.
On the top of the settings page of wp smtp, you can click the corresponding icon to view the sample screenshot. As shown in the following figure:
After configuration, you can enter the recipient and email content:
2. Modify the WP code to implement the Mail function.
Find the functions. Php file in the wordpress webpage file and open the editing file.
<Span style = "color: # ff0000;"> & lt ;? Php </span> <span style = "font-family: Georgia, 'Times New Roman ', 'Bitstream Charter', Times, serif; "> and </span> <span style =" color: # ff0000; ">? & Gt; </span>
Add the following code:
Add_action ('phpmailer _ init', 'mail _ smtp '); function mail_smtp ($ phpmailer) {$ phpmailer-> IsSMTP (); $ phpmailer-> SMTPAuth = true; // enable the SMTPAuth service $ phpmailer-> Port = 465; // SMTP mail sending Port, which corresponds to the following. If you enter 25 here, $ phpmailer-> SMTPSecure = "ssl" is not entered below; // whether to verify ssl. This corresponds to the above. If not entered, then the above Port must be 25 $ phpmailer-> Host = "smtp.zhuji91.com"; // SMTP server address of the mailbox. If it is Google's, it will be: smtp.gmail.com $ phpmailer-> Username = "admin@zhuji91.com"; // your email address $ phpmailer-> Password = "*****"; // your email login Password}
I personally think that the method of adding a plug-in is simpler and faster, but the method of modifying the code is also good. I hope it can help you.