mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
* Mail: Fix vacation notice can not deal with aliases, which have no domain set
This commit is contained in:
parent
676974fcdd
commit
524296b757
@ -442,12 +442,17 @@ class Script
|
||||
$newscriptbody .= "if header :contains ".'"X-Spam-Status" '.'"YES"'."{\n\tstop;\n}\n"; //stop vacation reply if it is spam
|
||||
}
|
||||
}
|
||||
$newscriptbody .= "vacation :days " . $vacation['days'] . " :addresses [";
|
||||
$newscriptbody .= "vacation :days " . $vacation['days'];
|
||||
$first = 1;
|
||||
foreach ($vacation['addresses'] as $vaddress) {
|
||||
if (!$first) $newscriptbody .= ", ";
|
||||
$newscriptbody .= "\"" . trim($vaddress) . "\"";
|
||||
$first = 0;
|
||||
if (!empty($vacation['addresses'][0]))
|
||||
{
|
||||
$newscriptbody .= " :addresses [";
|
||||
foreach ($vacation['addresses'] as $vaddress) {
|
||||
if (!$first) $newscriptbody .= ", ";
|
||||
$newscriptbody .= "\"" . trim($vaddress) . "\"";
|
||||
$first = 0;
|
||||
}
|
||||
$newscriptbody .= "] ";
|
||||
}
|
||||
$message = $vacation['text'];
|
||||
if ($vacation['start_date'] || $vacation['end_date'])
|
||||
@ -459,7 +464,7 @@ class Script
|
||||
date($format_date,$vacation['end_date']),
|
||||
),$message);
|
||||
}
|
||||
$newscriptbody .= "] text:\n" . $message . "\n.\n;\n\n";
|
||||
$newscriptbody .= " text:\n" . $message . "\n.\n;\n\n";
|
||||
}
|
||||
|
||||
// update with any changes.
|
||||
|
@ -447,13 +447,20 @@ class mail_sieve
|
||||
|
||||
$accAllIdentities = $this->account->smtpServer()->getAccountEmailAddress(Api\Accounts::id2name($accountID));
|
||||
$allAliases = $this->account->ident_email !=''? array($this->account->ident_email): array();
|
||||
foreach ($accAllIdentities as &$arrVal)
|
||||
foreach ($accAllIdentities as &$val)
|
||||
{
|
||||
if ($arrVal['type'] !='default')
|
||||
if ($val['type'] !='default')
|
||||
{
|
||||
$allAliases[] = $arrVal['address'];
|
||||
// if the alias has no domain part set try to add
|
||||
// default domain extracted from ident_email address
|
||||
$allAliases[] = self::fixInvalidAliasAddress($this->account->ident_email, $val['address']);
|
||||
}
|
||||
}
|
||||
// try to fix already stored aliases
|
||||
foreach ($vacation['addresses'] as &$address)
|
||||
{
|
||||
$address = self::fixInvalidAliasAddress($this->account->ident_email, $address);
|
||||
}
|
||||
asort($allAliases);
|
||||
return array(
|
||||
'vacation' =>$vacation,
|
||||
@ -461,6 +468,22 @@ class mail_sieve
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method tries to fix alias address lacking domain part
|
||||
* by trying to add domain extracted from given reference address
|
||||
*
|
||||
* @param string $refrence email address to be used for domain extraction
|
||||
* @param string $address alias address
|
||||
*
|
||||
* @return string returns alias address with appended default domain
|
||||
*/
|
||||
static function fixInvalidAliasAddress($refrence, $address)
|
||||
{
|
||||
$parts = explode('@', $refrence);
|
||||
if (!strpos($address,'@') && !empty($parts[1])) $address .= '@'.$parts[1];
|
||||
return $address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vacation edit
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user