From 4ac18dfc848538ff2023d3f1e7b2cfe2e48cccde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sun, 14 Jun 2020 20:52:42 +0200 Subject: [PATCH] MAPG-69 make emails HTML explicitly --- mail/{signup.tpl => signup.html} | 16 ++++++++-------- src/Mailing/Mail.php | 5 ++--- 2 files changed, 10 insertions(+), 11 deletions(-) rename mail/{signup.tpl => signup.html} (85%) diff --git a/mail/signup.tpl b/mail/signup.html similarity index 85% rename from mail/signup.tpl rename to mail/signup.html index c93b404..480e0c1 100644 --- a/mail/signup.tpl +++ b/mail/signup.html @@ -1,13 +1,13 @@ Hi, - -You recently signed up on MapGuesser with this email address ({{EMAIL}}). To activate your account, please click on the following link: +

+You recently signed up on MapGuesser with this email address ({{EMAIL}}). To activate your account, please click on the following link:
{{ACTIVATE_LINK}} - -If you did not sign up on MapGuesser or changed your mind, no further action is required, your email address will be deleted soon. -However if you want to immediately delete it, please click on the following link: +

+If you did not sign up on MapGuesser or changed your mind, no further action is required, your email address will be deleted soon.
+However if you want to immediately delete it, please click on the following link:
{{CANCEL_LINK}} - +

Have fun on MapGuesser! - -Regards, +

+Regards,
MapGuesser diff --git a/src/Mailing/Mail.php b/src/Mailing/Mail.php index 4c75dcb..0f14b68 100644 --- a/src/Mailing/Mail.php +++ b/src/Mailing/Mail.php @@ -27,7 +27,7 @@ class Mail public function setBodyFromTemplate(string $template, array $params = []): void { - $this->body = file_get_contents(ROOT . '/mail/' . $template . '.tpl'); + $this->body = file_get_contents(ROOT . '/mail/' . $template . '.html'); foreach ($params as $key => $param) { $this->body = str_replace('{{' . $key . '}}', $param, $this->body); @@ -62,9 +62,8 @@ class Mail $mailer->addReplyTo($_ENV['MAIL_FROM'], 'MapGuesser'); $mailer->Sender = !empty($_ENV['MAIL_BOUNCE']) ? $_ENV['MAIL_BOUNCE'] : $_ENV['MAIL_FROM']; - $mailer->Subject = $this->subject; - $mailer->Body = $this->body; + $mailer->msgHTML($this->body); foreach ($this->recipients as $recipient) { $this->sendMail($mailer, $recipient);