diff --git a/README.md b/README.md index 9755018..98b4592 100644 --- a/README.md +++ b/README.md @@ -55,9 +55,11 @@ Look at `src/DataFixtures/` to see an overview of all test data, including other ### Custom welcome mail -To add a custom welcome email, put the two templates (html and plain text) in: - -`templates/custom/email/html/welcome.html.twig` and `templates/custom/email/text/welcome.html.txt` +To add a custom welcome email, put the templates (html and plain text) in `templates/custom/email`. +Supported override templates are: +- `welcome.html.twig`, `welcome.html.txt.twig` +- `welcome_support-en.html.twig`, `welcome_support-en.txt.twig` +- `welcome_support-nl.html.twig`, `welcome_support-nl.txt.twig` ## Contributing diff --git a/src/Controller/Admin/MembershipApplicationCrud.php b/src/Controller/Admin/MembershipApplicationCrud.php index ab478db..ae00166 100644 --- a/src/Controller/Admin/MembershipApplicationCrud.php +++ b/src/Controller/Admin/MembershipApplicationCrud.php @@ -128,11 +128,11 @@ public function acceptApplication(AdminContext $context) $em->remove($application); $em->flush(); - $templatePrefix = ''; + $templatePrefix = ''; - if (is_dir($this->getParameter('kernel.project_dir') . '/templates/custom')) { - $templatePrefix = 'custom/'; - } + if (is_dir($this->getParameter('kernel.project_dir') . '/templates/custom')) { + $templatePrefix = 'custom/'; + } $message = (new Email()) ->subject("Welkom bij $organizationName!") diff --git a/src/Controller/SupportMemberController.php b/src/Controller/SupportMemberController.php index 53bfede..36d3af3 100644 --- a/src/Controller/SupportMemberController.php +++ b/src/Controller/SupportMemberController.php @@ -216,16 +216,22 @@ public function webhook(Request $request, MailerInterface $mailer, TranslatorInt $em->flush(); $noReplyMail = $this->getParameter('app.noReplyAddress'); + $templatePrefix = ''; + + if (is_dir($this->getParameter('kernel.project_dir') . '/templates/custom')) { + $templatePrefix = 'custom/'; + } + // Send confirmation email $message = (new Email()) ->subject($translator->trans('Welkom als steunlid bij ROOD, Socialistische Jongeren')) ->to(new Address($supportMember->getEmail(), $supportMember->getFirstName() .' '. $supportMember->getLastName())) ->from(new Address($noReplyMail, 'ROOD, Socialistische Jongeren')) ->html( - $this->renderView('email/html/welcome_support-' . $request->locale . '.html.twig', ['supportMember' => $supportMember]) + $this->renderView($templatePrefix . 'email/html/welcome_support-' . $request->locale . '.html.twig', ['supportMember' => $supportMember]) ) ->text( - $this->renderView('email/text/welcome_support-' . $request->locale . '.txt.twig', ['supportMember' => $supportMember]) + $this->renderView($templatePrefix . 'email/text/welcome_support-' . $request->locale . '.txt.twig', ['supportMember' => $supportMember]) ); $mailer->send($message);