Commit 53ca2776 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #561 in ZP/z-push from...

Merge pull request #561 in ZP/z-push from bugfix/ZP-1255-send-as-not-working-for-other-companies to develop

* commit '3bd67f6d':
  ZP-1255 Directly use sharedUser if it's an email address. Enables sending in multi-company environments.
parents ae197a3e 3bd67f6d
...@@ -474,10 +474,20 @@ class BackendKopano implements IBackend, ISearchProvider { ...@@ -474,10 +474,20 @@ class BackendKopano implements IBackend, ISearchProvider {
if ($sharedUser != false && $sharedUser != 'SYSTEM') { if ($sharedUser != false && $sharedUser != 'SYSTEM') {
$folders = ZPush::GetAdditionalSyncFolders(); $folders = ZPush::GetAdditionalSyncFolders();
if (isset($folders[$sm->source->folderid]) && ($folders[$sm->source->folderid]->Flags & DeviceManager::FLD_FLAGS_SENDASOWNER)) { if (isset($folders[$sm->source->folderid]) && ($folders[$sm->source->folderid]->Flags & DeviceManager::FLD_FLAGS_SENDASOWNER)) {
$sendAs = $this->resolveRecipientGAL($sharedUser, 1); $sendAs = false;
if (isset($sendAs[0])) { // for multi-company this is (mostly always) already an email address and we can just use it - ZP-1255
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KopanoBackend->SendMail(): Server side Send-As activated for shared folder. Sending as '%s'.", $sendAs[0]->emailaddress)); if (Utils::CheckEmail($sharedUser)) {
$sm->mime = preg_replace("/^From: .*?$/im", "From: ". $sendAs[0]->emailaddress, $sm->mime, 1); $sendAs = $sharedUser;
}
else {
$gabResult = $this->resolveRecipientGAL($sharedUser, 1);
if (isset($gabResult[0])) {
$sendAs = $gabResult[0]->emailaddress;
}
}
if ($sendAs) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KopanoBackend->SendMail(): Server side Send-As activated for shared folder. Sending as '%s'.", $sendAs));
$sm->mime = preg_replace("/^From: .*?$/im", "From: ". $sendAs, $sm->mime, 1);
$sendingAsSomeone = true; $sendingAsSomeone = true;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment