diff options
author | Andreas Gohr <andi@splitbrain.org> | 2005-12-03 14:15:42 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2005-12-03 14:15:42 +0100 |
commit | f95e691e3de814f9fd4e7afca38f3da9fd523d64 (patch) | |
tree | 9b2c654dba365d7e3bdaa5814ee7f0a4b9b059ff /inc | |
parent | 20b335b5f3ce16be51182ef08146d9bda732b484 (diff) | |
download | rpg-f95e691e3de814f9fd4e7afca38f3da9fd523d64.tar.gz rpg-f95e691e3de814f9fd4e7afca38f3da9fd523d64.tar.bz2 |
don't use named recipients in mails on Windows #652
darcs-hash:20051203131542-7ad00-9c65b70a7fade074b4d46939b1cc62984caa59c9.gz
Diffstat (limited to 'inc')
-rw-r--r-- | inc/mail.php | 13 |
1 files changed, 9 insertions, 4 deletions
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öö <foo@bar.com>, 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>"; |