I am using Mailer Send as my SMTP service and the Fluent SMTP plugin. But it does not matter the plugin with every SMTP plugin I get this error. When I try to send emails, I always get this error:

  "code": 423,
  "message": "SMTP Error: Could not connect to SMTP host. Failed to connect to server",
  "errors": [
    "SMTP Error: Could not connect to SMTP host. Failed to connect to server"

I have port 587 open in my firewall and my hosting provider allows email to be sent through this port. What can I do to solve this problem? Thank you for your answers.

  • are you sure your server is set up correctly? I don't believe this is a WordPress problem, but rather a general host problem. You would be better trying to send it directly via SSH/CLI on the host itself to confirm that a connection is actually possible, or even from your local computer. Likewise you mentioned port 587 is open on your server, but is it open on the SMTP server you're trying to connect it to? You should get in touch with your host
    – Tom J Nowell
    Jul 26, 2023 at 10:13
  • Yes, pretty sure. Mailer Send is a paid service, they are set up correctly and my server firewall is cofigured with the outgoing rule: Any IPv4, Any IPv6 TCP 587, so it should work. I wrote to the SMTP provider and my VPS host and both denied that it was a problem on their part.
    – AYNTK
    Jul 26, 2023 at 11:30
  • Is there any way I can get more information about the error so I can better understand where it is coming from?
    – AYNTK
    Jul 26, 2023 at 11:37
  • I think the error already has as much information as it could provide, it tried to make a connection to the server and failed, so no SMTP stuff had a chance to take place. Think of it like trying to talk to someone and being unable to find them, and I ask you what you said that made the conversation go badly, you can't debug SMTP if basic network connectivity prevents a connection. Note that you could plug your SMTP details into an email client and attempt to send an email and that too would be informative. Fundamentally though the chances this is WP related are very very low
    – Tom J Nowell
    Jul 26, 2023 at 12:03
  • 1
    and have you contacted your host?
    – Tom J Nowell
    Jul 26, 2023 at 13:53

1 Answer 1


Make the following test.

  1. Disable all of your SMTP plugins.
  2. Temporarily enable WP_DEBUG and WP_DEBUG_LOG in your "wp-config.php" file.
  3. Insert the following code in your theme "functions.php" file:
add_action( 'phpmailer_init', function ( $phpmailer ) {
    $phpmailer->Port       = 587;
    $phpmailer->SMTPAuth   = true;
    $phpmailer->SMTPSecure = 'tls';
    $phpmailer->FromName   = get_bloginfo( 'name' );

    // Type your SMTP credentials below.
    $phpmailer->From = ''; // This is the email address that will be used as sender.
    $phpmailer->Host = '';
    $phpmailer->Username = '';
    $phpmailer->Password = '';

    // Temporarily enable while debugging.
    $phpmailer->SMTPDebug = 1;
  1. Type your credentials in the snippet above and try to send an email. For example, try to reset your password.
  2. Did the message reach your inbox?
  3. If not, what's inside the file "debug.log" (".../wp-content/debug.log")?
  • Yes, I got the message but it took about 5 minutes to get to my inbox. It is not marked as spam, so it must have used the SMTP server. Or maybe not, because I see no use in my SMTP server dashboard, the credentials have not been used. What should I do now? Also just a note in my debug.og file ther is always this line: [26-Jul-2023 20:58:55 UTC] PHP Deprecated:
    – AYNTK
    Jul 26, 2023 at 20:59
  • Never mind, my dashboard was broken, it was using SMTP to send. But what should I do now WordPress emails are still not beeing sent (iThemes Security emails and ....)?
    – AYNTK
    Jul 27, 2023 at 17:55
  • @AYNTK so the reset password email was sent, but other emails are not being sent? And what's you php version and wp version? Jul 27, 2023 at 20:22
  • Yes exactely. PHP 8.2 and WordPress 6.2.2
    – AYNTK
    Jul 27, 2023 at 21:10
  • @AYNTK In this case an issue with SMTP connection is ruled out. I suggest you visit the article help.ithemes.com/hc/en-us/articles/… and thoroughly go through each item. It might solve your problem. LMK how that goes. Jul 27, 2023 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.