summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-10-10 19:24:52 +0200
committerAleksander Machniak <alec@alec.pl>2012-10-10 19:24:52 +0200
commit1ff03fb29deb9940cbd14b09a089815d0c1ca2e1 (patch)
tree136bf5ef0fdfae32c2288790fa870197a923a4b7
parentc2c162c240da9d3cb6a9b5644aff30cd6822b7fb (diff)
Fix lower-casing email address on replies (#1488598)
Conflicts: CHANGELOG
-rw-r--r--CHANGELOG1
-rw-r--r--program/include/rcube_shared.inc23
-rw-r--r--program/steps/mail/compose.inc9
3 files changed, 29 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 3962f9fa2..7607b1f67 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Fix lower-casing email address on replies (#1488598)
- Fix so subscribed non-existing/non-accessible shared folder can be unsubscribed
RELEASE 0.7.3
diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index 6767c93e7..c7461edf1 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -582,6 +582,29 @@ function array_keys_recursive($array)
/**
+ * Format e-mail address
+ *
+ * @param string $email E-mail address
+ *
+ * @return string Formatted e-mail address
+ */
+function format_email($email)
+{
+ $email = trim($email);
+ $parts = explode('@', $email);
+ $count = count($parts);
+
+ if ($count > 1) {
+ $parts[$count-1] = mb_strtolower($parts[$count-1]);
+
+ $email = implode('@', $parts);
+ }
+
+ return $email;
+}
+
+
+/**
* mbstring replacement functions
*/
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index a13507f53..2e12b0f05 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -243,7 +243,8 @@ $MESSAGE->identities = $USER->list_identities();
if (count($MESSAGE->identities))
{
foreach ($MESSAGE->identities as $idx => $ident) {
- $email = mb_strtolower(rcube_idn_to_utf8($ident['email']));
+ $ident['email'] = format_email($ident['email']);
+ $email = format_email(rcube_idn_to_utf8($ident['email']));
$MESSAGE->identities[$idx]['email_ascii'] = $ident['email'];
$MESSAGE->identities[$idx]['ident'] = format_email_recipient($ident['email'], $ident['name']);
@@ -268,7 +269,7 @@ else if (count($MESSAGE->identities)) {
$a_to = $IMAP->decode_address_list($MESSAGE->headers->to);
foreach ($a_to as $addr) {
if (!empty($addr['mailto'])) {
- $a_recipients[] = strtolower($addr['mailto']);
+ $a_recipients[] = format_email($addr['mailto']);
$a_names[] = $addr['name'];
}
}
@@ -277,7 +278,7 @@ else if (count($MESSAGE->identities)) {
$a_cc = $IMAP->decode_address_list($MESSAGE->headers->cc);
foreach ($a_cc as $addr) {
if (!empty($addr['mailto'])) {
- $a_recipients[] = strtolower($addr['mailto']);
+ $a_recipients[] = format_email($addr['mailto']);
$a_names[] = $addr['name'];
}
}
@@ -424,7 +425,7 @@ foreach ($parts as $header) {
if (empty($addr_part['mailto']))
continue;
- $mailto = mb_strtolower(rcube_idn_to_utf8($addr_part['mailto']));
+ $mailto = format_email(rcube_idn_to_utf8($addr_part['mailto']));
if (!in_array($mailto, $a_recipients)
&& ($header == 'to' || empty($MESSAGE->compose['from_email']) || $mailto != $MESSAGE->compose['from_email'])