diff options
author | thomascube <thomas@roundcube.net> | 2008-03-21 13:29:12 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2008-03-21 13:29:12 +0000 |
commit | 0c6f4b88648879cf12342d16c83bdd0d3a11672f (patch) | |
tree | 4f3b1180e4c9886abfddec7e5dc2d9fa890e8a52 /program/include/main.inc | |
parent | 46bc52b56a3201fc3e1aa687eb99725d8e26b37a (diff) |
Better patch to correctly quote email recipient strings (from #1484191)
Diffstat (limited to 'program/include/main.inc')
-rw-r--r-- | program/include/main.inc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index 3a1d64734..cb25fbd77 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -1567,7 +1567,10 @@ function format_date($date, $format=NULL) function format_email_recipient($email, $name='') { if ($name && $name != $email) - return sprintf('%s <%s>', strpos($name, ",") ? '"'.$name.'"' : $name, $email); + { + // Special chars as defined by RFC 822 need to in quoted string (or escaped). + return sprintf('%s <%s>', preg_match('/[\(\)\<\>\\\.\[\]@,;:"]/', $name) ? '"'.addcslashes($name, '"').'"' : $name, $email); + } else return $email; } |