Make WordPress Core

Opened 5 years ago

Closed 5 months ago

#52504 closed defect (bug) (worksforme)

wp_mail() not able to send/deliver emails to domain with hyphens in it?

Reported by: veryaca's profile verya.ca Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.7
Component: Mail Keywords:
Focuses: Cc:

Description

I tested many plugins and all of them, who uses wp_mail(), are not sending/delivering emails to domain with hyphens in it.

I tested on 3 different hosts, with 4 different domain names. When an email is sent to a domain with hyphens in it, it's not delivered. Seems like the "sanitizing" process is causing an issue maybe?

Change History (3)

#1 @davidbaumwald
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Severity changed from critical to normal
  • Status changed from new to closed
  • Version changed from 5.6.1 to trunk

Hi, @verya.ca, and welcome to WordPress Core Trac!!

I think that you may have some plugin/theme interacting negatively with wp_mail. For some perspective, my own business domain is hyphenated and has not experienced this issue.

Please check in with the support forums at https://wordpress.org/support/forums/, and maybe they can help you better pinpoint the issue.

If, however, it's confirmed there is indeed a bug in WordPress Core and the wp_mail function, feel free to reopen this ticket with more information.

#2 @verya.ca
5 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

In a newly installed WP, without any plugins installed, if I use the wp_mail() function directly in the Twenty Twenty One theme, it's not working. I tested on different hosts with different email addresses.

Last edited 5 years ago by verya.ca (previous) (diff)

#3 @SirLouen
5 months ago

  • Resolution set to worksforme
  • Status changed from reopened to closed

Reproduction Report

Description

❌ This report can't validate that the issue can be reproduced.

Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.2.29
  • Server: nginx/1.29.0
  • Database: mysqli (Server: 8.4.6 / Client: mysqlnd 8.2.29)
  • Browser: Chrome 138.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Twenty-Five 1.3
  • MU Plugins: None activated
  • Plugins:
    • Testing Dolly
    • Test Reports 1.2.0

Testing Instructions

  1. Simply send an email to a domain with hyphens (-) as reported.
  2. 👌 Email is sent and delivered as expected.

Actual Results

  1. ❌ Error condition is not occurring.

Additional Notes

  • As @davidbaumwald did already observe, there is no element that hinders hyphens by default.
  • Below I attach a raw message sent from a domain with hyphens and to a domain with hypens
  • @veryaca before reopening this report, please provide exact reproduction instructions, more environment information, what you are using, what email server, etc. Some debug logs will be very useful (enable WP_DEBUG_LOG and WP_DEBUG_DISPLAY), also email server logs will help a lot. Unfortunatelly, just saying that "it doesn't work" is not enough to help you.
  • Closing this again, but as worksforme.

Supplemental Artifacts

Return-Path: <supertester@example-test-2.org>
Received: from localhost (unknown [172.20.0.1])
        by 144d19eeeff3 (Mailpit) with SMTP
        for <you@example-test-1.org>; Wed, 6 Aug 2025 14:57:27 +0000 (UTC)
Date: Wed, 6 Aug 2025 14:57:27 +0000
To: you@example-test-1.org
From: WordPress <supertester@example-test-2.org>
Subject: Baseline test
Message-ID: <hBCTzYc7C58VJlAhwnM5iV0lG5lprP6TjepNuDCldo@localhost>
X-Mailer: PHPMailer 6.9.3 (https://github.com/PHPMailer/PHPMailer)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8

See attachments.
Note: See TracTickets for help on using tickets.