Email send bugfix empty recipients, bugfix IMAP error display

This commit is contained in:
OpenXE 2024-04-17 16:34:00 +02:00
parent c1727b389e
commit 5c1a5d04df

View File

@ -25671,21 +25671,25 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
$bccRecipients[] = new EmailRecipient($bcc3, $bcc3);
}
// This will build the mail with phpmailer 6 and send it out
// There is no way to retrieve the created mail e.g. for IMAP output
// This should be migrated to laminas-mail (used for imap)
// Phpmailer 6 can then be removed
$sysMailerSent = $sysMailer->composeAndSendEmail(
$from,
$from_name,
$recipients,
$betreff,
$body,
$files,
$ccRecipients,
$bccRecipients,
$sendmail_error
);
if (!empty($recipients)) {
// This will build the mail with phpmailer 6 and send it out
// There is no way to retrieve the created mail e.g. for IMAP output
// This should be migrated to laminas-mail (used for imap)
// Phpmailer 6 can then be removed
$sysMailerSent = $sysMailer->composeAndSendEmail(
$from,
$from_name,
$recipients,
$betreff,
$body,
$files,
$ccRecipients,
$bccRecipients,
$sendmail_error
);
} else {
$sendmail_error = "Kein Empfänger angegeben";
}
}
if($sysMailerSent === false) {
@ -25742,11 +25746,12 @@ function MailSendFinal($from,$from_name,$to,$to_name,$betreff,$text,$files="",$p
$client->connect();
$client->appendMessage($imapCopyMessage, $account->getImapOutgoingFolder());
} catch (Exception $e) {
$this->app->erp->LogFile("Mailer Error: " . (string) $e);
$this->app->erp->LogFile("Mailer IMAP Error: " . (string) $e);
if(isset($this->app->User) && $this->app->User && method_exists($this->app->User, 'GetID'))
{
$this->app->erp->InternesEvent($this->app->User->GetID(),"IMAP-Fehler","alert",1);
}
$this->mail_error = "Mailer IMAP Error";
return 0;
}
}