From 1cafcd459a642c1a69ce233f22ff2858611eff21 Mon Sep 17 00:00:00 2001 From: alec Date: Tue, 9 Aug 2011 09:46:54 +0000 Subject: - Fix handling of email addresses with quoted local part (#1487939) git-svn-id: https://svn.roundcube.net/trunk@5033 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/lib/Mail/mimePart.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'roundcubemail/program/lib/Mail') diff --git a/roundcubemail/program/lib/Mail/mimePart.php b/roundcubemail/program/lib/Mail/mimePart.php index 60b3601e0..5674792b4 100644 --- a/roundcubemail/program/lib/Mail/mimePart.php +++ b/roundcubemail/program/lib/Mail/mimePart.php @@ -131,6 +131,7 @@ class Mail_mimePart */ var $_eol = "\r\n"; + /** * Constructor. * @@ -800,6 +801,9 @@ class Mail_mimePart // Structured header (make sure addr-spec inside is not encoded) if (!empty($separator)) { + // Simple e-mail address regexp + $email_regexp = '(\S+|("\s*(?:[^"\f\n\r\t\v\b\s]+\s*)+"))@\S+'; + $parts = Mail_mimePart::_explodeQuotedString($separator, $value); $value = ''; @@ -817,12 +821,12 @@ class Mail_mimePart } // let's find phrase (name) and/or addr-spec - if (preg_match('/^<\S+@\S+>$/', $part)) { + if (preg_match('/^<' . $email_regexp . '>$/', $part)) { $value .= $part; - } else if (preg_match('/^\S+@\S+$/', $part)) { + } else if (preg_match('/^' . $email_regexp . '$/', $part)) { // address without brackets and without name $value .= $part; - } else if (preg_match('/<*\S+@\S+>*$/', $part, $matches)) { + } else if (preg_match('/<*' . $email_regexp . '>*$/', $part, $matches)) { // address with name (handle name) $address = $matches[0]; $word = str_replace($address, '', $part); -- cgit v1.2.3