- fix identity name quoting when sending mail as per discussion in #1485654

release-0.6
alecpl 16 years ago
parent 99f2b311bf
commit a1733f06ae

@ -64,7 +64,13 @@ function rcmail_get_identity($id)
{ {
$out = $sql_arr; $out = $sql_arr;
$out['mailto'] = $sql_arr['email']; $out['mailto'] = $sql_arr['email'];
$name = strpos($sql_arr['name'], ",") ? '"'.$sql_arr['name'].'"' : $sql_arr['name'];
// Special chars as defined by RFC 822 need to in quoted string (or escaped).
if (preg_match('/[\(\)\<\>\\\.\[\]@,;:"]/', $sql_arr['name']))
$name = '"' . addcslashes($sql_arr['name'], '"') . '"';
else
$name = $sql_arr['name'];
$out['string'] = rcube_charset_convert($name, RCMAIL_CHARSET, $OUTPUT->get_charset()); $out['string'] = rcube_charset_convert($name, RCMAIL_CHARSET, $OUTPUT->get_charset());
if ($sql_arr['email']) if ($sql_arr['email'])
$out['string'] .= ' <' . $sql_arr['email'] . '>'; $out['string'] .= ' <' . $sql_arr['email'] . '>';

Loading…
Cancel
Save