From 8356ebbd154b3a3cf0c9c945c09e131583d37f29 Mon Sep 17 00:00:00 2001 From: Camille Simiand <camille.simiand@tetras-libre.fr> Date: Wed, 15 Dec 2021 09:45:28 +0100 Subject: [PATCH] Add a MAILER SENDER environment variable --- .env_default | 2 ++ config/packages/mailer.yaml | 4 ++++ src/Controller/RegistrationController.php | 1 - src/Controller/ResetPasswordController.php | 10 ---------- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.env_default b/.env_default index d0a85c5..7121211 100644 --- a/.env_default +++ b/.env_default @@ -60,6 +60,8 @@ BY_PASS_CODE=ed156b9188ecddf0c556d5712f0a84cc # Use smtp or mail in production MAILER_DSN=null://null SYMFONY_SECRET=0f817363a768f111a17d2522b8d7e2d72cf738b1 +MAILER_SENDER=contact@localhost.com + LEGACY_SRC_SHARED=./capsule-prototype LEGACY_URL=http://legacy/ LEGACY_URL_EXTERNAL=http://localhost:8081/legacy/ diff --git a/config/packages/mailer.yaml b/config/packages/mailer.yaml index 56a650d..d9c251e 100644 --- a/config/packages/mailer.yaml +++ b/config/packages/mailer.yaml @@ -1,3 +1,7 @@ framework: mailer: dsn: '%env(MAILER_DSN)%' + envelope: + sender: '%env(MAILER_SENDER)%' + headers: + from: 'MemoRekall <%env(MAILER_SENDER)%>' \ No newline at end of file diff --git a/src/Controller/RegistrationController.php b/src/Controller/RegistrationController.php index c07ad95..22b0b9c 100644 --- a/src/Controller/RegistrationController.php +++ b/src/Controller/RegistrationController.php @@ -65,7 +65,6 @@ class RegistrationController extends AbstractController 'app_verify_email', $user, (new TemplatedEmail()) - ->from(new Address('contact@localhost.com', 'MemoRekall')) ->to($user->getEmail()) ->subject('Please Confirm your Email') ->htmlTemplate('registration/confirmation_email.html.twig') diff --git a/src/Controller/ResetPasswordController.php b/src/Controller/ResetPasswordController.php index 2a0236a..1df4e65 100644 --- a/src/Controller/ResetPasswordController.php +++ b/src/Controller/ResetPasswordController.php @@ -153,20 +153,10 @@ class ResetPasswordController extends AbstractController try { $resetToken = $this->resetPasswordHelper->generateResetToken($user); } catch (ResetPasswordExceptionInterface $e) { - // If you want to tell the user why a reset email was not sent, uncomment - // the lines below and change the redirect to 'app_forgot_password_request'. - // Caution: This may reveal if a user is registered or not. - // - // $this->addFlash('reset_password_error', sprintf( - // 'There was a problem handling your password reset request - %s', - // $e->getReason() - // )); - return $this->redirectToRoute('app_check_email'); } $email = (new TemplatedEmail()) - ->from(new Address('contact@localhost.com', 'MemoRekall')) ->to($user->getEmail()) ->subject('Your password reset request') ->htmlTemplate('reset_password/email.html.twig') -- GitLab