From 13c6cf5aba1be21507f3221022a5641ab976cd61 Mon Sep 17 00:00:00 2001 From: loviuz Date: Wed, 5 Feb 2020 10:05:15 +0100 Subject: [PATCH] Modificato invio email da moduli in invio istantaneo --- actions.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/actions.php b/actions.php index ba065fb02..6304d932e 100644 --- a/actions.php +++ b/actions.php @@ -7,6 +7,7 @@ use Models\OperationLog; use Modules\Checklists\Check; use Modules\Checklists\Checklist; use Modules\Emails\Template; +use Notifications\EmailNotification; if (empty($structure) || empty($structure['enabled'])) { die(tr('Accesso negato')); @@ -241,9 +242,18 @@ elseif (post('op') == 'send-email') { } $mail->save(); - OperationLog::setInfo('id_email', $mail->id); - flash()->info(tr('Email aggiunta correttamente alla coda di invio!')); + // Invio mail istantaneo + $email = EmailNotification::build($mail); + $email_success = $email->send(); + + if ($email_success){ + OperationLog::setInfo('id_email', $mail->id); + flash()->info(tr('Email inviata correttamente!')); + } else { + $mail->delete(); + flash()->error(tr('Errore durante l\'invio email! Verifica i parametri dell\'account SMTP utilizzato.')); + } } // Inclusione di eventuale plugin personalizzato