From bed40129718664403807199fef7691494ad32958 Mon Sep 17 00:00:00 2001 From: thisfro Date: Fri, 28 May 2021 11:23:04 +0200 Subject: [PATCH] start working on trade email sending --- src/Controller/TradeController.php | 39 +++++++++++++++++++++ templates/offer/trade/trade_email.html.twig | 5 +++ 2 files changed, 44 insertions(+) create mode 100644 src/Controller/TradeController.php create mode 100644 templates/offer/trade/trade_email.html.twig diff --git a/src/Controller/TradeController.php b/src/Controller/TradeController.php new file mode 100644 index 0000000..502cda9 --- /dev/null +++ b/src/Controller/TradeController.php @@ -0,0 +1,39 @@ +getUser(); + $offer = $offeringRepository->(); + + if(/* user not the logged in user */) + $email = (new Email()) + ->from('no-reply@pfleanz.li') + ->to(/* user of offer */) + ->replyTo(/* logged in user */) + ->subject('Time for Symfony Mailer!') + ->text('Sending emails is fun again!') + ->htmlTemplate('user/trade/offer_email.html.twig'); + try + { + $mailer->send($email); + } catch (TransportExceptionInterface $e) { + // TODO: + // print error + } + return $this->redirectToRoute('/offer', {'id': $id}); + } +} diff --git a/templates/offer/trade/trade_email.html.twig b/templates/offer/trade/trade_email.html.twig new file mode 100644 index 0000000..979ba20 --- /dev/null +++ b/templates/offer/trade/trade_email.html.twig @@ -0,0 +1,5 @@ +

{{ user.username}} wants to trade!

+ +

You can checkout their offer and reply to this email if you want to trade.

+ + \ No newline at end of file