Merged in bugfix/MAPG-69-fix-mail-template-processing (pull request #113)

MAPG-69 make emails HTML explicitly
This commit is contained in:
Bence Pőcze 2020-06-14 18:53:44 +00:00
commit 6d431717f8
2 changed files with 10 additions and 11 deletions

View File

@ -1,13 +1,13 @@
Hi, Hi,
<br><br>
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:<br>
<a href="{{ACTIVATE_LINK}}" title="Account activation">{{ACTIVATE_LINK}}</a> <a href="{{ACTIVATE_LINK}}" title="Account activation">{{ACTIVATE_LINK}}</a>
<br><br>
If you did not sign up on MapGuesser or changed your mind, no further action is required, your email address will be deleted soon. If you did not sign up on MapGuesser or changed your mind, no further action is required, your email address will be deleted soon.<br>
However if you want to immediately delete it, please click on the following link: However if you want to immediately delete it, please click on the following link:<br>
<a href="{{CANCEL_LINK}}" title="Sign up cancellation">{{CANCEL_LINK}}</a> <a href="{{CANCEL_LINK}}" title="Sign up cancellation">{{CANCEL_LINK}}</a>
<br><br>
Have fun on MapGuesser! Have fun on MapGuesser!
<br><br>
Regards, Regards,<br>
MapGuesser MapGuesser

View File

@ -27,7 +27,7 @@ class Mail
public function setBodyFromTemplate(string $template, array $params = []): void 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) { foreach ($params as $key => $param) {
$this->body = str_replace('{{' . $key . '}}', $param, $this->body); $this->body = str_replace('{{' . $key . '}}', $param, $this->body);
@ -62,9 +62,8 @@ class Mail
$mailer->addReplyTo($_ENV['MAIL_FROM'], 'MapGuesser'); $mailer->addReplyTo($_ENV['MAIL_FROM'], 'MapGuesser');
$mailer->Sender = !empty($_ENV['MAIL_BOUNCE']) ? $_ENV['MAIL_BOUNCE'] : $_ENV['MAIL_FROM']; $mailer->Sender = !empty($_ENV['MAIL_BOUNCE']) ? $_ENV['MAIL_BOUNCE'] : $_ENV['MAIL_FROM'];
$mailer->Subject = $this->subject; $mailer->Subject = $this->subject;
$mailer->Body = $this->body; $mailer->msgHTML($this->body);
foreach ($this->recipients as $recipient) { foreach ($this->recipients as $recipient) {
$this->sendMail($mailer, $recipient); $this->sendMail($mailer, $recipient);