summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-03-12 13:54:56 +0000
committeralecpl <alec@alec.pl>2010-03-12 13:54:56 +0000
commitb579f42b550a5c3f3bf11a0cee13149d67c1bcd8 (patch)
tree68d13b189b796353cc51803c6d6aaa04b34b73c1
parentb9d751df60a8f0126848a976b6c045a790ee36eb (diff)
- fixes for proper handling of email addresses with form: "user"@domain.tld
-rw-r--r--program/include/rcube_imap.php10
-rw-r--r--program/include/rcube_smtp.php6
-rw-r--r--program/steps/mail/func.inc2
3 files changed, 10 insertions, 8 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index cb8299607..91d36c2a3 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -2675,8 +2675,12 @@ class rcube_imap
foreach ($a as $val)
{
$j++;
- $address = $val['address'];
- $name = preg_replace(array('/^[\'"]/', '/[\'"]$/'), '', trim($val['name']));
+ $address = trim($val['address']);
+ $name = trim($val['name']);
+
+ if (preg_match('/^[\'"]/', $name) && preg_match('/[\'"]$/', $name))
+ $name = preg_replace(array('/^[\'"]/', '/[\'"]$/'), '', $name);
+
if ($name && $address && $name != $address)
$string = sprintf('%s <%s>', preg_match("/$special_chars/", $name) ? '"'.addcslashes($name, '"').'"' : $name, $address);
else if ($address)
@@ -2687,7 +2691,7 @@ class rcube_imap
$out[$j] = array('name' => $name,
'mailto' => $address,
'string' => $string);
-
+
if ($max && $j==$max)
break;
}
diff --git a/program/include/rcube_smtp.php b/program/include/rcube_smtp.php
index 658e4760c..1dfe222d5 100644
--- a/program/include/rcube_smtp.php
+++ b/program/include/rcube_smtp.php
@@ -392,14 +392,14 @@ class rcube_smtp {
$addresses = array();
$recipients = rcube_explode_quoted_string(',', $recipients);
-
+
reset($recipients);
while (list($k, $recipient) = each($recipients))
{
$a = explode(" ", $recipient);
while (list($k2, $word) = each($a))
{
- if ((strpos($word, "@") > 0) && (strpos($word, "\"")===false))
+ if (strpos($word, "@") > 0 && $word[strlen($word)-1] != '"')
{
$word = preg_replace('/^<|>$/', '', trim($word));
if (in_array($word, $addresses)===false)
@@ -411,5 +411,3 @@ class rcube_smtp {
}
}
-
-?>
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 32b522c5c..1968d20b2 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1191,7 +1191,7 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null)
if ($got_writable_abook === null && $books = $RCMAIL->get_address_sources(true)) {
$got_writable_abook = true;
}
-
+
foreach ($a_parts as $part) {
$j++;
if ($PRINT_MODE) {