|
|
@ -242,21 +242,27 @@ else if (!empty($_SESSION['compose']['param']['from'])) {
|
|
|
|
$MESSAGE->compose['from'] = $_SESSION['compose']['param']['from'];
|
|
|
|
$MESSAGE->compose['from'] = $_SESSION['compose']['param']['from'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (count($MESSAGE->identities)) {
|
|
|
|
else if (count($MESSAGE->identities)) {
|
|
|
|
// extract all recipients of the reply-message
|
|
|
|
|
|
|
|
$a_recipients = array();
|
|
|
|
$a_recipients = array();
|
|
|
|
|
|
|
|
$a_names = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// extract all recipients of the reply-message
|
|
|
|
if (is_object($MESSAGE->headers) && in_array($compose_mode, array(RCUBE_COMPOSE_REPLY, RCUBE_COMPOSE_FORWARD)))
|
|
|
|
if (is_object($MESSAGE->headers) && in_array($compose_mode, array(RCUBE_COMPOSE_REPLY, RCUBE_COMPOSE_FORWARD)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$a_to = $IMAP->decode_address_list($MESSAGE->headers->to);
|
|
|
|
$a_to = $IMAP->decode_address_list($MESSAGE->headers->to);
|
|
|
|
foreach ($a_to as $addr) {
|
|
|
|
foreach ($a_to as $addr) {
|
|
|
|
if (!empty($addr['mailto']))
|
|
|
|
if (!empty($addr['mailto'])) {
|
|
|
|
$a_recipients[] = strtolower($addr['mailto']);
|
|
|
|
$a_recipients[] = strtolower($addr['mailto']);
|
|
|
|
|
|
|
|
$a_names[] = $addr['name'];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($MESSAGE->headers->cc)) {
|
|
|
|
if (!empty($MESSAGE->headers->cc)) {
|
|
|
|
$a_cc = $IMAP->decode_address_list($MESSAGE->headers->cc);
|
|
|
|
$a_cc = $IMAP->decode_address_list($MESSAGE->headers->cc);
|
|
|
|
foreach ($a_cc as $addr) {
|
|
|
|
foreach ($a_cc as $addr) {
|
|
|
|
if (!empty($addr['mailto']))
|
|
|
|
if (!empty($addr['mailto'])) {
|
|
|
|
$a_recipients[] = strtolower($addr['mailto']);
|
|
|
|
$a_recipients[] = strtolower($addr['mailto']);
|
|
|
|
|
|
|
|
$a_names[] = $addr['name'];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -285,10 +291,13 @@ else if (count($MESSAGE->identities)) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// use replied message recipients
|
|
|
|
// use replied message recipients
|
|
|
|
else if (in_array($ident['email_ascii'], $a_recipients)) {
|
|
|
|
else if (($found = array_search($ident['email_ascii'], $a_recipients)) !== false) {
|
|
|
|
|
|
|
|
// match identity name, prefer default identity
|
|
|
|
|
|
|
|
if ($from_idx === null || ($a_names[$found] && $ident['name'] && $a_names[$found] == $ident['name'])) {
|
|
|
|
$from_idx = $idx;
|
|
|
|
$from_idx = $idx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Fallback using Return-Path
|
|
|
|
// Fallback using Return-Path
|
|
|
|
if ($from_idx === null && $return_path) {
|
|
|
|
if ($from_idx === null && $return_path) {
|
|
|
|