diff options
author | Elan Ruusamäe <glen@pld-linux.org> | 2011-02-11 11:10:53 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2011-02-11 11:11:26 +0100 |
commit | 0667123fd26e32f9e914b6bb4a2bfcd6f894c076 (patch) | |
tree | 6336509b41ba814212aafc64b4c6c1437fd1e0f2 /inc/mail.php | |
parent | 52784dd85122f75ca221c53d4fd9dcc98bfd2450 (diff) | |
download | dokuwiki-0667123fd26e32f9e914b6bb4a2bfcd6f894c076.tar.gz dokuwiki-0667123fd26e32f9e914b6bb4a2bfcd6f894c076.zip |
correctly encode quoted email names
Diffstat (limited to 'inc/mail.php')
-rw-r--r-- | inc/mail.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/inc/mail.php b/inc/mail.php index f991909d0..bd6c0db6a 100644 --- a/inc/mail.php +++ b/inc/mail.php @@ -203,7 +203,16 @@ function mail_encode_address($string,$header='',$names=true){ } if(!utf8_isASCII($text)){ - $text = '=?UTF-8?Q?'.mail_quotedprintable_encode($text,0).'?='; + // put the quotes outside as in =?UTF-8?Q?"Elan Ruusam=C3=A4e"?= vs "=?UTF-8?Q?Elan Ruusam=C3=A4e?=" + if (preg_match('/^"(.+)"$/', $text, $matches)) { + $text = '"=?UTF-8?Q?'.mail_quotedprintable_encode($matches[1], 0).'?="'; + } else { + $text = '=?UTF-8?Q?'.mail_quotedprintable_encode($text, 0).'?='; + } + // additionally the space character should be encoded as =20 (or each + // word QP encoded separately). + // however this is needed only in mail headers, not globally in mail_quotedprintable_encode(). + $text = str_replace(" ", "=20", $text); } }else{ $text = ''; |