SMTP -> ERROR: Failed to connect to server: Connection timed out (110)

I get this error frequently when I use the PHPMailer library, i.e. for a WordPress site.

The strange thing is, this will work on your localhost but not on the remote server.

It is not a problem with PHPMailer, or WordPress, or your mail server.

It is a problem with your hosting configuration (I’m using Namecheap for hosting but I assume you have cPanel installed).

How to fix:

  1. LogĀ into cPanel, and under the “Mail” section, choose “MX Entry”.
  2. Add MX records as shown below. (I’m using Zoho as my mail server, and their addresses are and

Screen Shot 2015-11-16 at 11.46.38 PM