[wp-trac] [WordPress Trac] #25239: $_SERVER['SERVER_NAME'] not a reliable when generating email host names
WordPress Trac
noreply at wordpress.org
Mon Oct 10 20:16:51 UTC 2016
#25239: $_SERVER['SERVER_NAME'] not a reliable when generating email host names
-------------------------------------------------+-------------------------
Reporter: layotte | Owner:
Type: defect (bug) | SergeyBiryukov
Priority: normal | Status: reviewing
Component: Mail | Milestone: Future
Severity: normal | Release
Keywords: has-patch dev-feedback needs- | Version: 3.8
testing | Resolution:
| Focuses:
-------------------------------------------------+-------------------------
Comment (by desmith):
Okay, let's try this again.
This patch adds a new function in pluggable.php,
{{{get_current_domain()}}}. Does what it says on the tin, returns the
current blog domain name, with leading 'www.' stripped. It also modifies a
few places where emails are sent, to use that function instead of
{{{$_SERVER['SERVER_NAME']}}}, notably in the password reset email-send,
which fixes the issue with wp-cli password reset emails.
There is a possible side effect. Since I replaced
{{{$_SERVER['SERVER_NAME']}}} in several email-related places, anyone
that's depending on their emails' From: headers looking like
support at www.theirsite instead of support at theirsite will be disappointed. I
could un-patch those instances, of course, but I think this behavior is
cleaner overall.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/25239#comment:45>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list