Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#37881 closed defect (bug) (duplicate)

Win OS Apache 2.4 Php 5.6.. : WP 4.6 no email sent

Reported by: axewww's profile axewww Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: Mail Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

On a test win localhost, where apache 2.4 and php 5.6.. are installed, I've think in first, were an error on plugins installed. Disabled all plugins, nothing. No email sent on 4.6. Reinstalled a new 4.6 ... nothing, no email is send out, also if php mail log file report correctly email has been sent:

[26-Aug-2016 22:10:19 UTC] mail() on [F:\HTDOCS\ROOT_INTEGRATIONS\wordpress\wp-includes\class-phpmailer.php:677]: To: me@w3it.org -- Headers: Date: Fri, 26 Aug 2016 22:10:19 +0000 From: axew <wordpress@localhost> Reply-To: "\"me@axew3.com\"" <me@axew3.com> Message-ID: <8fce4f82facb168edc150c6d59f4af00@localhost> X-Mailer: PHPMailer 5.2.14 (https://github.com/PHPMailer/PHPMailer) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit
[26-Aug-2016 22:11:14 UTC] mail() on [F:\HTDOCS\ROOT_INTEGRATIONS\wordpress\wp-includes\class-phpmailer.php:677]: To: you@mysite.org -- Headers: Date: Fri, 26 Aug 2016 22:11:14 +0000 From: axew <wordpress@localhost> Reply-To: "\"me@axew3.com\"" <me@axew3.com> Message-ID: <cfa75915dd6435213641910a1dc888c8@localhost> X-Mailer: PHPMailer 5.2.14 (https://github.com/PHPMailer/PHPMailer) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit

All emails seem to be correctly sent out, but nothing will never arrive. On WP 4.6.
Finally i've reinstall WP 4.5 to test out it: on it work well. And the log file returned, the same, ever without php errors.
on WP 4.6, win OS apache server test:

pluggable.php

$phpmailer->setFrom( $from_email, $from_name );

change with

$phpmailer->setFrom( $from_email, $from_name, false );

it will make return work email onregister (that i've test out) on 4.6.

public function setFrom() of class-phpmailer.php, the value of $this->Sender is empty and this code on it:

<?php
if ($auto) {
            if (empty($this->Sender)) {
                $this->Sender = $address;
            }
        }

is executed, so to $this->Sender will be assigned the value of $address (that is wordpress@localhost). Should be ok, but it lead to that emails aren't sent if the email isn't completely well formed. In fact adding

$from_email = $from_email . '.com'

just before $phpmailer->setFrom call on pluggable.php work ok.
also other solution

$phpmailer->setFrom( $from_email, $from_name, false );

get wp 4.6 email work ok in the server i test this behavior on.
in this case $this->Sender = $address; on setFrom() isn't executed and all work ok. Email are sent.
Both solutions resolve the problem, this let me (maybe) think to:
a following check of email address, if it is not well formed, lead to fail on sending out emails.

I've see hints on pluggable:

	/* If we don't have an email from the input headers default to wordpress@$sitename
	 * Some hosts will block outgoing mail from this address if it doesn't exist but
	 * there's no easy alternative. Defaulting to admin_email might appear to be another
	 * option but some hosts may refuse to relay mail from an unknown domain. See
	 * https://core.trac.wordpress.org/ticket/5007.
	 */

Change History (3)

#1 @swissspidy
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hey there,

Thanks for your report. This has already been fixed in #37736 and will be included in 4.6.1, which is scheduled to be released next week.

#2 @SergeyBiryukov
8 years ago

  • Description modified (diff)

#3 @axewww
8 years ago

:) nice! Thank you!

Note: See TracTickets for help on using tickets.