|
|
@ -298,7 +298,6 @@ else if (count($MESSAGE->identities)) {
|
|
|
|
$from_idx = null;
|
|
|
|
$from_idx = null;
|
|
|
|
$found_idx = null;
|
|
|
|
$found_idx = null;
|
|
|
|
$default_identity = 0; // default identity is always first on the list
|
|
|
|
$default_identity = 0; // default identity is always first on the list
|
|
|
|
$return_path = $MESSAGE->headers->others['return-path'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Select identity
|
|
|
|
// Select identity
|
|
|
|
foreach ($MESSAGE->identities as $idx => $ident) {
|
|
|
|
foreach ($MESSAGE->identities as $idx => $ident) {
|
|
|
@ -332,8 +331,8 @@ else if (count($MESSAGE->identities)) {
|
|
|
|
$from_idx = $found_idx;
|
|
|
|
$from_idx = $found_idx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Fallback using Return-Path
|
|
|
|
// Try Return-Path
|
|
|
|
if ($from_idx === null && $return_path) {
|
|
|
|
if ($from_idx === null && ($return_path = $MESSAGE->headers->others['return-path'])) {
|
|
|
|
foreach ($MESSAGE->identities as $idx => $ident) {
|
|
|
|
foreach ($MESSAGE->identities as $idx => $ident) {
|
|
|
|
if (strpos($return_path, str_replace('@', '=', $ident['email_ascii']).'@') !== false) {
|
|
|
|
if (strpos($return_path, str_replace('@', '=', $ident['email_ascii']).'@') !== false) {
|
|
|
|
$from_idx = $idx;
|
|
|
|
$from_idx = $idx;
|
|
|
@ -342,6 +341,16 @@ else if (count($MESSAGE->identities)) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fallback using Delivered-To
|
|
|
|
|
|
|
|
if ($from_idx === null && ($delivered_to = $MESSAGE->headers->others['delivered-to'])) {
|
|
|
|
|
|
|
|
foreach ($MESSAGE->identities as $idx => $ident) {
|
|
|
|
|
|
|
|
if (in_array($ident['email_ascii'], $delivered_to)) {
|
|
|
|
|
|
|
|
$from_idx = $idx;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$ident = $MESSAGE->identities[$from_idx !== null ? $from_idx : $default_identity];
|
|
|
|
$ident = $MESSAGE->identities[$from_idx !== null ? $from_idx : $default_identity];
|
|
|
|
$from_id = $ident['identity_id'];
|
|
|
|
$from_id = $ident['identity_id'];
|
|
|
|
|
|
|
|
|
|
|
|