edit-icon download-icon

How can I use WordPress to send emails through Web Hosting?

Last Updated: Nov 09, 2018

Web Hosting sends emails in the fsockopen mode, while WordPress sends emails in the steam_connect_client mode. For WordPress to use a Web Hosting instance to send an email, you must modify the program configuration file /wp-include/class-smtpp.php.

Follow these steps to modify /wp-include/class-smtpp.php file:

  1. Access website files via FileZilla and locate /wp-include/class-smtpp.php.

  2. Download the file to your local computer.

  3. Open the file and find the following code:

    Note: You can open the file by code editors, such as Notepad++.

    1. $this->smtp_conn = @stream_socket_client( $host . “:” . $port, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $socket_context );
  4. Modify the code as the following:
    1. $this->smtp_conn = @fsockopen($host,$port,$errno,$errstr,$timeout);
  5. Save the modified file and upload it to FTP site by FileZilla.

WordPress should now be able to send email by Web Hosting instance.

If this tutorial cannot help you solve the problem, open a ticket.

Thank you! We've received your feedback.