[wp-trac] [WordPress Trac] #54465: Error message with invalid receipent

WordPress Trac noreply at wordpress.org
Sat Jul 12 17:40:02 UTC 2025


#54465: Error message with invalid receipent
-------------------------+------------------------------
 Reporter:  sanzeeb3     |       Owner:  (none)
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Mail         |     Version:  5.8
 Severity:  normal       |  Resolution:  invalid
 Keywords:               |     Focuses:
-------------------------+------------------------------
Changes (by SirLouen):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 According to the
 [https://datatracker.ietf.org/doc/html/rfc5322#section-3.4.1 RFC 5322,
 section 3.4.1], emails starting and ending with a dot are not permitted
 (`dot-atom` format means, `atext` with dots **surrounded** with `atext`
 only, `atext` doesn't include dots
 ([https://datatracker.ietf.org/doc/html/rfc5322#section-3.2.3 More info
 about types of tokens])

 So basically, here is that this address `nameSurname. at gmail.com` is not
 valid.

 Although using my example code for sending emails:

 {{{#!php
 <?php
 function send_email_menu() {
         add_menu_page(
                 'Send Test Email',
                 'TestEmail Sender',
                 'manage_options',
                 'send-email-page',
                 'send_email_page_html'
         );
 }
 add_action( 'admin_menu', 'send_email_menu' );

 function send_email_page_html() {
         ?>
         <div class="wrap">
                 <h1>Send a Test Email</h1>
                 <?php
                 if ( isset( $_POST['send_email'] ) && 1 === (int)
 $_POST['send_email'] ) {
             $to = "nameSurname. at gmail.com";
             $subject = "Subject";
             $body = "Message";

                         if ( wp_mail( $to, $subject, $body) ) {
                                 echo '<div class="notice notice-success
 is-dismissible"><p>Message successfully sent.</p></div>';
                         } else {
                                 echo '<div class="notice notice-error is-
 dismissible"><p>Message sending failed.</p></div>';
                         }
                 }
                 ?>
                 <form method="post" action="">
                         <input type="hidden" name="send_email" value="1">
                         <?php submit_button( 'Send Test Email' ); ?>
                 </form>
         </div>
         <?php
 }
 }}}


 We can see that this is the result when sending the email:

 {{{
 Return-Path: <wordpress at mailhog.local>
 Received: from localhost (wordpress-develop-php-1.wordpress-
 develop_wpdevnet. [172.18.0.3])
         by d2756ddb9791 (Mailpit) with SMTP
         for <nameSurname. at gmail.com>; Sat, 12 Jul 2025 17:25:56 +0000
 (UTC)
 Date: Sat, 12 Jul 2025 17:25:56 +0000
 To: nameSurname. at gmail.com
 From: WordPress <wordpress at mailhog.local>
 Subject: Subject
 Message-ID: <nUcLDNeY6tTDsDB3ReQB88Sfd3pQrxN0QRugoMqqR4 at localhost>
 X-Mailer: PHPMailer 6.9.3 (https://github.com/PHPMailer/PHPMailer)
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8

 Message
 }}}

 The email, although, is being delivered with `wp_mail` despite not being
 compliant.

 Closing this for being `invalid` for not compliant with the RFC.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54465#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list