Aleksander Machniak
2014-01-05 b23b3f2c35f6f1c1b534f88d4b517ff49e7ae002
Fix case-sensitivity of email addresses handling on compose (#1485499)
2 files modified
25 ■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/steps/mail/compose.inc 24 ●●●● patch | view | raw | blame | history
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)
program/steps/mail/compose.inc
@@ -294,6 +294,7 @@
$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 @@
                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;
            }
        }