summaryrefslogtreecommitdiff
path: root/program/steps/mail/sendmail.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-10-29 13:45:25 +0000
committeralecpl <alec@alec.pl>2011-10-29 13:45:25 +0000
commitf1654a33b271f80422729f72d58695130724cb98 (patch)
tree8cfa22f30759a3208361c4ffcfdc59a98de6fd6b /program/steps/mail/sendmail.inc
parent799e1201459b1ee6422d2725b502376b34950f23 (diff)
- Applied fixes from trunk up to r5371
Diffstat (limited to 'program/steps/mail/sendmail.inc')
-rw-r--r--program/steps/mail/sendmail.inc13
1 files changed, 6 insertions, 7 deletions
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index deddb45e8..5022444a7 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -159,14 +159,14 @@ function rcmail_email_input_format($mailto, $count=false, $check=true)
$item = trim($item);
// address in brackets without name (do nothing)
if (preg_match('/^<'.$email_regexp.'>$/', $item)) {
- $item = rcube_idn_to_ascii($item);
- $result[] = $item;
+ $item = rcube_idn_to_ascii(trim($item, '<>'));
+ $result[] = '<' . $item . '>';
// address without brackets and without name (add brackets)
} else if (preg_match('/^'.$email_regexp.'$/', $item)) {
$item = rcube_idn_to_ascii($item);
- $result[] = '<'.$item.'>';
+ $result[] = '<' . $item . '>';
// address with name (handle name)
- } else if (preg_match('/'.$email_regexp.'>*$/', $item, $matches)) {
+ } else if (preg_match('/<*'.$email_regexp.'>*$/', $item, $matches)) {
$address = $matches[0];
$name = str_replace($address, '', $item);
$name = trim($name);
@@ -174,9 +174,8 @@ function rcmail_email_input_format($mailto, $count=false, $check=true)
&& preg_match('/[\(\)\<\>\\\.\[\]@,;:"]/', $name)) {
$name = '"'.addcslashes($name, '"').'"';
}
- $address = rcube_idn_to_ascii($address);
- if (!preg_match('/^<'.$email_regexp.'>$/', $address))
- $address = '<'.$address.'>';
+ $address = rcube_idn_to_ascii(trim($address, '<>'));
+ $address = '<' . $address . '>';
$result[] = $name.' '.$address;
$item = $address;