Fix case-sensitivity of email addresses handling on compose (#1485499)

pull/160/head
Aleksander Machniak 11 years ago
parent 4957530dec
commit b23b3f2c35

@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail CHANGELOG Roundcube Webmail
=========================== ===========================
- Fix case-sensitivity of email addresses handling on compose (#1485499)
- Don't alter Message-ID of a draft when sending (#1489409) - Don't alter Message-ID of a draft when sending (#1489409)
- Fix issue where deprecated syntax for HTML lists was not handled properly (#1488768) - Fix issue where deprecated syntax for HTML lists was not handled properly (#1488768)
- Display different icons when Trash folder is empty or full (#1485775) - Display different icons when Trash folder is empty or full (#1485775)

@ -294,6 +294,7 @@ else if (count($MESSAGE->identities)) {
$a_recipients = array(); $a_recipients = array();
$parts = array('to', 'cc', 'bcc', 'replyto', 'followupto'); $parts = array('to', 'cc', 'bcc', 'replyto', 'followupto');
$separator = trim($RCMAIL->config->get('recipients_separator', ',')) . ' '; $separator = trim($RCMAIL->config->get('recipients_separator', ',')) . ' ';
$from_email = @mb_strtolower($MESSAGE->compose['from_email']);
foreach ($parts as $header) { foreach ($parts as $header) {
$fvalue = ''; $fvalue = '';
@ -391,21 +392,20 @@ foreach ($parts as $header) {
continue; 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) if (($header == 'to' || $compose_mode != RCUBE_COMPOSE_REPLY || $mailto_lc != $from_email)
&& ($header == 'to' && !in_array($mailto_lc, $a_recipients)
|| $compose_mode != RCUBE_COMPOSE_REPLY
|| empty($MESSAGE->compose['from_email'])
|| $mailto != $MESSAGE->compose['from_email'])
) { ) {
if ($addr_part['name'] && $addr_part['mailto'] != $addr_part['name']) if ($addr_part['name'] && $mailto != $addr_part['name']) {
$string = format_email_recipient($mailto, $addr_part['name']); $mailto = format_email_recipient($mailto, $addr_part['name']);
else }
$string = $mailto;
$fvalue[] = $string; $fvalue[] = $mailto;
$a_recipients[] = $addr_part['mailto']; $a_recipients[] = $mailto_lc;
} }
} }

Loading…
Cancel
Save