[wp-trac] [WordPress Trac] #25239: $_SERVER['SERVER_NAME'] not a reliable when generating email host names

WordPress Trac noreply at wordpress.org
Tue Sep 4 14:41:38 UTC 2018


#25239: $_SERVER['SERVER_NAME'] not a reliable when generating email host names
-------------------------------------------------+-------------------------
 Reporter:  layotte                              |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  reviewing
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Mail                                 |     Version:  3.8
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback needs-        |     Focuses:
  testing                                        |
-------------------------------------------------+-------------------------

Comment (by bastho):

 Hi,
 I just discover this ticket (I've opened a duplicate).

 Here is my thought:

 [38287] forces PHPMailer's setFrom() to don't set Sender field.

 It seems to improve compatibility on some server environments, but it's a
 regression on those which support `-f` option. On these ones, the Sender
 is something like www-data at host which can cause SPF failure if the server
 name doesn't match the domain name (which occurs pretty often).

 While this setting is very dependent of the server environment, I suggest
 to add a constant `WP_MAIL_AUTO_SENDER` to determine the expected
 behavior.

 I know that introducing this constant does not match the ''"Decision, not
 option"'' directive, but I can't figure how to determine if the server
 supports or not the `-f` option.

 This patch
 https://core.trac.wordpress.org/attachment/ticket/25239/25239.patch makes
 the trick.

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


More information about the wp-trac mailing list