[wp-trac] Re: [WordPress Trac] #6829: FromName causing emails not to send using Windows

WordPress Trac wp-trac at lists.automattic.com
Thu May 1 16:57:40 GMT 2008


#6829: FromName causing emails not to send using Windows
-----------------------+----------------------------------------------------
 Reporter:  mrtwice99  |        Owner:  anonymous
     Type:  defect     |       Status:  new      
 Priority:  normal     |    Milestone:  2.5.2    
Component:  General    |      Version:  2.5      
 Severity:  normal     |   Resolution:           
 Keywords:  email      |  
-----------------------+----------------------------------------------------
Comment (by mrtwice99):

 "Is the email not being sent at all? Does it show up in your spam folder?"

 That is correct, PHP is not sending the email at all.  No error message
 from the mail function either (I took out the '@' to see if I could get an
 error).

 I think it has something to do with the fact that it is setting the FROM
 email address like

 {{{
 Mr. Smith <mr.smith at example.com>
 }}}

 I tested this on my local machine with the following script (obviously the
 email addresses where changed):


 {{{
 $to      = 'person at example.com';
 $subject = 'the subject';
 $message = 'hello2';
 $headers = 'From: Me <mr.smith at example.com>' . "\r\n" .
    'Reply-To: mr.smith at example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();


 mail($to, $subject, $message, $headers);
 }}}

 When I ran the script on Windows with a similar php.ini setup, I got the
 following error message:

 {{{
 Warning: mail(): SMTP server response: 501 5.5.4 Invalid Address
 }}}

 When I set the from header to:

 {{{
 $headers = 'From: mr.smith at example.com' . "\r\n" .
 }}}

 The error went away and the email sent correctly.  The mail()
 documentation warns about this:

   Second, the custom headers like From:, Cc:, Bcc: and Date: are not
 interpreted by
   the MTA in the first place, but are parsed by PHP.
   As such, the to parameter should not be an address in the form of
 "Something
   <someone at example.com>". The mail command may not parse this properly
 while talking
   with the MTA.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6829#comment:2>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list