summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-12-29 14:43:45 +0000
committeralecpl <alec@alec.pl>2008-12-29 14:43:45 +0000
commita1733f06ae1031f0c5ae5ea2e92380ac5ce56494 (patch)
tree54ac0de7d6d0d348c5ad7022287d89dbf5bae2c9 /program/steps/mail
parent99f2b311bfc057d168118d2d7f36e3aa0ebc208d (diff)
- fix identity name quoting when sending mail as per discussion in #1485654
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/sendmail.inc8
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'] . '>';