diff options
| author | polo <ordipolo@gmx.fr> | 2025-12-17 13:33:07 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-12-17 13:33:07 +0100 |
| commit | 8393acd0366ee3408db103ba29e8686bab127f42 (patch) | |
| tree | bf6f6170caea009f9ffeb5b5827536cf893c9820 /src/EmailService.php | |
| parent | fc14268ad5d644680a5802eb1af4691bb9294dd5 (diff) | |
| download | cms-8393acd0366ee3408db103ba29e8686bab127f42.tar.gz cms-8393acd0366ee3408db103ba29e8686bab127f42.tar.bz2 cms-8393acd0366ee3408db103ba29e8686bab127f42.zip | |
Diffstat (limited to 'src/EmailService.php')
| -rw-r--r-- | src/EmailService.php | 4 |
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 | ||
| 12 | class EmailService | 12 | class 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); |
