Skip to content

Commit

Permalink
Fix email variables
Browse files Browse the repository at this point in the history
  • Loading branch information
pingiun committed May 19, 2024
1 parent b8918cf commit 754c349
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/Controller/MemberController.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ private function createPayment(Customer $customer, float $contributionAmount) {
public function handleRedirect(Request $request, string $customerId): Response
{
$membershipApplicationRepository = $this->getDoctrine()->getRepository(MembershipApplication::class);
/** @var MembershipApplication $membershipApplication */
$membershipApplication = $membershipApplicationRepository->findOneByMollieCustomerId($customerId);

if ($membershipApplication !== null && $membershipApplication->getPaid())
Expand All @@ -181,19 +182,21 @@ public function handleRedirect(Request $request, string $customerId): Response
$templatePrefix = 'custom/';
}

$member = $this->getUser();
$memberEmail = $membershipApplication->getEmail();
$memberFullName = $membershipApplication->getFullName();
$memberFirstName = $membershipApplication->getFirstName();

$emailSender = $this->getParameter('app.noReplyAddress');
$organizationName = $this->getParameter('app.organizationEmail');
$message = (new Email())
->subject("Bedankt voor je aanmelding bij $organizationName!")
->to(new Address($member->getEmail(), $member->getFullName()))
->to(new Address($memberEmail, $memberFullName))
->from(new Address($emailSender, $organizationName))
->html(
$this->renderView($templatePrefix . 'email/html/apply.html.twig', ['member' => $member])
$this->renderView($templatePrefix . 'email/html/apply.html.twig', ['memberFirstName' => $memberFirstName])
)
->text(
$this->renderView($templatePrefix . 'email/text/apply.txt.twig', ['member' => $member])
$this->renderView($templatePrefix . 'email/text/apply.txt.twig', ['memberFirstName' => $memberFirstName])
);
$this->mailer->send($message);

Expand Down
2 changes: 1 addition & 1 deletion templates/email/html/apply.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'email/html/layout.html.twig' %}
{% block content %}
<p>
Beste {{ member.firstName }},
Beste {{ memberFirstName }},
</p>
<p>
Bedankt voor het aanmelden bij {{ organisatienaam }}. De afdeling zal je aanmelding verwerken waarna u nog een bevestigingsmail zult ontvangen.
Expand Down
2 changes: 1 addition & 1 deletion templates/email/text/apply.txt.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'email/text/layout.txt.twig' %}
{% block content %}
Beste {{ member.firstName }},
Beste {{ memberFirstName }},

Bedankt voor het aanmelden bij {{ organisatienaam }}. De afdeling zal je aanmelding verwerken waarna u nog een bevestigingsmail zult ontvangen.

Expand Down

0 comments on commit 754c349

Please sign in to comment.