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

WordPress Trac noreply at wordpress.org
Sun Nov 27 06:01:14 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 dd32):

 Replying to [comment:54 riasat]:
 > {{{
 > server {
 >       listen         80;
 >       server_name    ~^(?<subdomain>.+?)\.(?<domain>.+)$;
 >       root  /var/www/$subdomain;
 >       include conf.d/server_block_common.cnf;
 > }
 >
 > }}}
 >
 > This is what I always get:
 >
 > {{{
 > Fatal error:  Uncaught phpmailerException: Invalid address:
 wordpress@~^(?<subdomain>.+?)\\.(?<domain>.+)$ in
 > }}}

 @riasat Just focusing on your error here, rather than the ticket - Looks
 like you've got a error in your nginx config there, although that should
 work for matching (and appears to be), the matched name isn't be passed to
 PHP, instead it's passing the literal regex through.
 You need to correct the value being passed to PHP through `fastcgi_param
 SERVER_NAME ...` in your nginx config, something like
 http://serverfault.com/questions/650560/nginx-regex-vhost-pattern-ends-up-
 as-php-server-name should set your on your way.

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


More information about the wp-trac mailing list