aboutsummaryrefslogtreecommitdiff
path: root/src/EmailService.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2025-12-17 13:33:07 +0100
committerpolo <ordipolo@gmx.fr>2025-12-17 13:33:07 +0100
commit8393acd0366ee3408db103ba29e8686bab127f42 (patch)
treebf6f6170caea009f9ffeb5b5827536cf893c9820 /src/EmailService.php
parentfc14268ad5d644680a5802eb1af4691bb9294dd5 (diff)
downloadcms-8393acd0366ee3408db103ba29e8686bab127f42.tar.gz
cms-8393acd0366ee3408db103ba29e8686bab127f42.tar.bz2
cms-8393acd0366ee3408db103ba29e8686bab127f42.zip
choix d'enregistrer ou non les messages en BDD, non par défaut dans EmailServiceHEADmain
Diffstat (limited to 'src/EmailService.php')
-rw-r--r--src/EmailService.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/EmailService.php b/src/EmailService.php
index 8671817..5d1b2eb 100644
--- a/src/EmailService.php
+++ b/src/EmailService.php
@@ -11,6 +11,8 @@ use App\Entity\NodeData;
11 11
12class EmailService 12class EmailService
13{ 13{
14 const KEEP_EMAILS_DEFAULT = false;
15
14 static public function send(EntityManager $entityManager, NodeData $form_data, bool $test_email, string $name = '', string $email = '', string $message = ''): bool 16 static public function send(EntityManager $entityManager, NodeData $form_data, bool $test_email, string $name = '', string $email = '', string $message = ''): bool
15 { 17 {
16 $mail = new PHPMailer(true); // true => exceptions 18 $mail = new PHPMailer(true); // true => exceptions
@@ -64,7 +66,7 @@ class EmailService
64 $mail->send(); 66 $mail->send();
65 67
66 // copie en BDD 68 // copie en BDD
67 if(!$test_email){ 69 if(!$test_email && ($form_data->getData()['keep_emails'] ?? self::KEEP_EMAILS_DEFAULT)){
68 $db_email = new Email($name, $email, Config::$email_dest, $message); 70 $db_email = new Email($name, $email, Config::$email_dest, $message);
69 $entityManager->persist($db_email); 71 $entityManager->persist($db_email);
70 self::updateLastContactDate($entityManager, $email); 72 self::updateLastContactDate($entityManager, $email);