From f95e691e3de814f9fd4e7afca38f3da9fd523d64 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 3 Dec 2005 14:15:42 +0100 Subject: don't use named recipients in mails on Windows #652 darcs-hash:20051203131542-7ad00-9c65b70a7fade074b4d46939b1cc62984caa59c9.gz --- inc/mail.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'inc') diff --git a/inc/mail.php b/inc/mail.php index 339dbf9ad..eeef4f66b 100644 --- a/inc/mail.php +++ b/inc/mail.php @@ -42,7 +42,10 @@ function mail_send($to, $subject, $body, $from='', $cc='', $bcc='', $headers=nul $header = ''; - $to = mail_encode_address($to); + // No named recipients for To: in Windows (see FS#652) + $usenames = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? false : true; + + $to = mail_encode_address($to,'',$usenames); $header .= mail_encode_address($from,'From'); $header .= mail_encode_address($cc,'Cc'); $header .= mail_encode_address($bcc,'Bcc'); @@ -71,9 +74,11 @@ function mail_send($to, $subject, $body, $from='', $cc='', $bcc='', $headers=nul * Example: * mail_encode_address("föö , me@somewhere.com","TBcc"); * - * @param string $string Multiple headers seperated by commas + * @param string $string Multiple adresses separated by commas + * @param string $header Name of the header (To,Bcc,Cc,...) + * @param boolean $names Allow named Recipients? */ -function mail_encode_address($string,$header=''){ +function mail_encode_address($string,$header='',$names=true){ $headers = ''; $parts = split(',',$string); foreach ($parts as $part){ @@ -104,7 +109,7 @@ function mail_encode_address($string,$header=''){ } // text was given - if(!empty($text)){ + if(!empty($text) && $names){ // add address quotes $addr = "<$addr>"; -- cgit v1.2.3