From b5a29fe22fccdd9b89914c4215655388995facd3 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 26 Oct 2011 09:53:30 -0400
Subject: [PATCH] - Fix IDN address validation issue (#1488137)
---
CHANGELOG | 2 ++
program/steps/mail/sendmail.inc | 13 ++++++-------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index f9c1ff0..d154fbc 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
CHANGELOG Roundcube Webmail
===========================
+- Fix IDN address validation issue (#1488137)
+- Fix JS error when dst_active checkbox doesn't exist (#1488133)
- Autocomplete LDAP records when adding contacts from mail (#1488073)
- Plugin API: added 'ready' hook (#1488063)
- Ignore DSN request when it isn't supported by SMTP server (#1487800)
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index deddb45..5022444 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -159,14 +159,14 @@
$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 @@
&& 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;
--
Gitblit v1.9.1