-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use new Brevo email sender instead of mailjet
- Loading branch information
Showing
9 changed files
with
133 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
framework: | ||
mailer: | ||
dsn: '%env(MAILER_DSN)%' | ||
|
||
when@test: | ||
framework: | ||
mailer: | ||
dsn: 'null://null' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Service\Mail\Brevo\User; | ||
|
||
use Symfony\Component\Mailer\MailerInterface; | ||
use Symfony\Component\Mime\Email; | ||
|
||
class ConfirmRegistrationEmail | ||
{ | ||
private const TEMPLATE_ID = '1'; | ||
|
||
public function __construct(private readonly MailerInterface $mailer) | ||
{ | ||
} | ||
|
||
public function send(string $recipientEmail, string $username, string $confirmEmail) | ||
{ | ||
$email = (new Email()) | ||
->from('[email protected]') | ||
->to($recipientEmail) | ||
->text('Confirmer votre email'); | ||
$email->getHeaders() | ||
->addTextHeader('templateId', self::TEMPLATE_ID) | ||
->addParameterizedHeader('params', 'params', [ | ||
'confirmation_link' => $confirmEmail, | ||
'username' => $username, | ||
]); | ||
$this->mailer->send($email); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,11 @@ public function test_register() | |
$this->assertSame('super_username', $results[0]->getUsername()); | ||
$this->assertSame('[email protected]', $results[0]->getEmail()); | ||
$this->assertNotSame('password', $results[0]->getPassword()); // we assert that we don't record plain text password in db | ||
$this->assertEmailCount(1); | ||
|
||
$email = $this->getMailerMessage(); | ||
|
||
$this->assertEmailTextBodyContains($email, 'Confirmer votre email'); | ||
} | ||
|
||
public function test_register_with_errors() | ||
|
@@ -67,6 +72,7 @@ public function test_register_with_errors() | |
'code' => '9ff3fdc4-b214-49db-8718-39c315e33d45', | ||
], | ||
]); | ||
$this->assertEmailCount(0); | ||
} | ||
|
||
public function test_register_already_have_account() | ||
|
@@ -79,5 +85,6 @@ public function test_register_already_have_account() | |
$this->assertJsonEquals([ | ||
'errors' => 'you already have an account', | ||
]); | ||
$this->assertEmailCount(0); | ||
} | ||
} |