Solution to SMTP failure in sending emails to wordpress on the HiChina host

Source: Internet
Author: User
Tags wordpress version
HiChina hosts all seem to need to send emails through SMTP, and enable fsockopen. However, the SMTP sending method of WordPress is steam_connect_client instead of fsockopen.

HiChina hosts all seem to need to send emails through SMTP, and to enable fsockopen (this can be enabled in HiChina background. if not, please contact HiChina customer service ). But the SMTP sending method of WordPress is steam_connect_client rather than fsockopen, so open/wp-include/class-smtp.php is about 274-282 line location, find the following code:


$ Socket_context = stream_context_create ($ options );
$ This-> smtp_conn = @ stream_socket_client (
$ Host. ":". $ port,
$ Errno,
$ Errstr,
$ Timeout,
STREAM_CLIENT_CONNECT,
$ Socket_context
);

Modify it to the following code:


$ This-> smtp_conn = @ fsockopen ($ host, $ port, $ errno, $ errstr, $ timeout );

Then use the SMTP plug-in such as wp smtp or wp mail smtp to send emails. you can configure it.

Note: This method directly modifies the core code of WordPress. once you upgrade the WordPress version, you need to modify it again. please REMEMBER !!!

The above is the details about how to solve the problem that wordpress cannot send emails to SMTP on the HiChina host. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.