diff options
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); |
