Skip to content
Snippets Groups Projects
Commit f95e691e authored by Andreas Gohr's avatar Andreas Gohr
Browse files

don't use named recipients in mails on Windows #652

darcs-hash:20051203131542-7ad00-9c65b70a7fade074b4d46939b1cc62984caa59c9.gz
parent 20b335b5
No related branches found
No related tags found
No related merge requests found
......@@ -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>";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment