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