[wp-trac] [WordPress Trac] #18792: Wrong FROM email when using wp_mail and built in mail() function
WordPress Trac
noreply at wordpress.org
Tue Sep 17 09:00:31 UTC 2013
#18792: Wrong FROM email when using wp_mail and built in mail() function
-------------------------------------+------------------------------
Reporter: pigster | Owner: westi
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: Awaiting Review
Component: External Libraries | Version: 3.2.1
Severity: normal | Resolution:
Keywords: has-patch needs-refresh |
-------------------------------------+------------------------------
Comment (by gruvin):
I just got through finding this bug, fixing it myself, searching the bug
tracker here to find this issue and, well, here are my observations on the
state of play ...
As of release version 3.6.1, the patch from KevinHamilton above has
apparently still not been implemented, though the code on pluggable.php
has had new stuff addedd ...
{{{
pluggable.php:
309: $phpmailer->ClearAddresses();
310: $phpmailer->ClearAllRecipients();
311: $phpmailer->ClearAttachments();
312: $phpmailer->ClearBCCs();
313: $phpmailer->ClearCCs();
314: $phpmailer->ClearCustomHeaders();
315: $phpmailer->ClearReplyTos();
}}}
I checked the ClearAddresses method, hoping it was clearing Sender. But
it's not. Not sure if it should. Perhaps there needs to be a ClearFrom
method added to the PHPMailer class?
I see that Sender does need to be reset in, because it only gets set in
SetFrom if it's currently empty.
{{{
class-phpmailer.php:
713 if (empty($this->Sender)) {
714 $this->Sender = $address;
715 }
}}}
Also, the original patch provided by pigster, who opened this ticket also
still remains. Specifically, PHPMailer's internal class properties are
being accessed directly in the following code, inadvertently preventing
property Sender from ever being set ...
{{{
pluggable.php
341: $phpmailer->From = apply_filters( 'wp_mail_from' ,
$from_email );
342: $phpmailer->FromName = apply_filters( 'wp_mail_from_name',
$from_name );
}}}
I found and fixed that problem myself, just before locating this bug
ticket, unsurprisingly in the precise same way as pigster, as follows ...
{{{
pluggable.php:
341: $phpmailer->SetFrom(apply_filters( 'wp_mail_from' ,
$from_email ), apply_filters( 'wp_mail_from_name', $from_name ));
}}}
It works, albeit not accounting for the looping issue, noted by
KevinHamilton, above.
Did I mention that this bug has been around for at least two years and has
causes a massive amount of trouble in terms of mail getting tagged as spam
and what not for a very, very long time? Surely that is a serious thing,
no? Perplexed, I am. *shrug*
Has this issue been addressed already development versions 3.7 or v3.8,
perhaps? How far away are those from release anyway? Where would I go to
find that out myself?
Can I contribute code or a patch directly, have it verified and actually
included in v3.6.2 somehow? I've read the docs. I know how to submit bug
reports, patches and more. But not how to actually get this thing sorted.
"Somewhat frustrating.", said the new kid on the block.
In the meantime, is there already plugin that addresses this fault
specifically? I have not been able to find one -- though there are several
that go around the problem it causes, evidently not realising where the
original fault actually lies. (The Xmail plugin, for one, uses an
incredibly convoluted and unnecessarily complex method to get around this
bug. Clever ... but oh so unneeded, if this simple error were just fixed.
:-/ ) Should I go to the effort of writing a plugin that fixes this? (At
first glance, it doesn't seem likely that a plugin could wedge into the
right places to do such a thing. I don't want to write another Xmail.)
--OR-- Is wp_mail() deprecated anyway -- or should it be, in favor of
using PHPMailer class directly in all plugins from now on? Frankly, I'm
too new to Wordpress to even guess. Any and all comments welcomed, either
here or to my email (assuming you get to see that?)
Gruvin.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18792#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list