Correctly quote email recipient string

release-0.6
thomascube 17 years ago
parent 9e60d4b991
commit 52f8caf770

@ -2285,7 +2285,7 @@ class rcube_imap
$address = $val['address']; $address = $val['address'];
$name = preg_replace(array('/^[\'"]/', '/[\'"]$/'), '', trim($val['name'])); $name = preg_replace(array('/^[\'"]/', '/[\'"]$/'), '', trim($val['name']));
if ($name && $address && $name != $address) if ($name && $address && $name != $address)
$string = sprintf('%s <%s>', strpos($name, ',')!==FALSE ? '"'.$name.'"' : $name, $address); $string = sprintf('%s <%s>', preg_match('/[,;<>]/', $name) ? '"'.addcslashes($name, '"').'"' : $name, $address);
else if ($address) else if ($address)
$string = $address; $string = $address;
else if ($name) else if ($name)

Loading…
Cancel
Save