summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--program/steps/mail/compose.inc24
2 files changed, 13 insertions, 12 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 2e278a8c6..c6a8bd0f0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Fix case-sensitivity of email addresses handling on compose (#1485499)
- Don't alter Message-ID of a draft when sending (#1489409)
- Fix issue where deprecated syntax for HTML lists was not handled properly (#1488768)
- Display different icons when Trash folder is empty or full (#1485775)
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 93496eb99..db001d54e 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -294,6 +294,7 @@ else if (count($MESSAGE->identities)) {
$a_recipients = array();
$parts = array('to', 'cc', 'bcc', 'replyto', 'followupto');
$separator = trim($RCMAIL->config->get('recipients_separator', ',')) . ' ';
+$from_email = @mb_strtolower($MESSAGE->compose['from_email']);
foreach ($parts as $header) {
$fvalue = '';
@@ -391,21 +392,20 @@ foreach ($parts as $header) {
continue;
}
- $mailto = format_email(rcube_utils::idn_to_utf8($addr_part['mailto']));
+ // According to RFC5321 local part of email address is case-sensitive
+ // however, here it is better to compare addresses in case-insensitive manner
+ $mailto = format_email(rcube_utils::idn_to_utf8($addr_part['mailto']));
+ $mailto_lc = mb_strtolower($addr_part['mailto']);
- if (!in_array($mailto, $a_recipients)
- && ($header == 'to'
- || $compose_mode != RCUBE_COMPOSE_REPLY
- || empty($MESSAGE->compose['from_email'])
- || $mailto != $MESSAGE->compose['from_email'])
+ if (($header == 'to' || $compose_mode != RCUBE_COMPOSE_REPLY || $mailto_lc != $from_email)
+ && !in_array($mailto_lc, $a_recipients)
) {
- if ($addr_part['name'] && $addr_part['mailto'] != $addr_part['name'])
- $string = format_email_recipient($mailto, $addr_part['name']);
- else
- $string = $mailto;
+ if ($addr_part['name'] && $mailto != $addr_part['name']) {
+ $mailto = format_email_recipient($mailto, $addr_part['name']);
+ }
- $fvalue[] = $string;
- $a_recipients[] = $addr_part['mailto'];
+ $fvalue[] = $mailto;
+ $a_recipients[] = $mailto_lc;
}
}