diff options
Diffstat (limited to 'program/steps/mail/sendmail.inc')
-rw-r--r-- | program/steps/mail/sendmail.inc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 21e1a7ff1..8e8d13919 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -64,7 +64,13 @@ function rcmail_get_identity($id) { $out = $sql_arr; $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()); if ($sql_arr['email']) $out['string'] .= ' <' . $sql_arr['email'] . '>'; |