From 93d0ec06a66b56bea205c9626300bc4e31ec4614 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 25 May 2013 12:25:41 +0200 Subject: [PATCH] adding proper headers for HTML mail --- public/include/classes/user.class.php | 8 +++++++- public/templates/mail/body.tpl | 23 ++++++++++------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/public/include/classes/user.class.php b/public/include/classes/user.class.php index 3e373ab7..d54b2da5 100644 --- a/public/include/classes/user.class.php +++ b/public/include/classes/user.class.php @@ -368,7 +368,13 @@ class User { $smarty->assign('TOKEN', $token); $smarty->assign('USERNAME', $username); $smarty->assign('WEBSITENAME', $this->config['website']['name']); - if (mail($email, $smarty->fetch('templates/mail/subject.tpl'), $smarty->fetch('templates/mail/body.tpl'))) { + $headers = 'From: Website Administration <' . $this->config['website']['email'] . ">\n"; + $headers .= "MIME-Version: 1.0\n"; + $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; + if (mail($email, + $smarty->fetch('templates/mail/subject.tpl'), + $smarty->fetch('templates/mail/body.tpl'), + $headers)) { return true; } else { $this->setErrorMessage("Unable to send mail to your address"); diff --git a/public/templates/mail/body.tpl b/public/templates/mail/body.tpl index ad36501d..a80b579a 100644 --- a/public/templates/mail/body.tpl +++ b/public/templates/mail/body.tpl @@ -1,13 +1,10 @@ -Hello {$USERNAME}, - -You have requested a password reset through our online form. -In order to complete the request please follow this link - -http://{$smarty.server.SERVER_NAME}{$smarty.server.PHP_SELF}?page=password&action=change&token={$TOKEN} - -You will be asked to change your password. You can then use this new -password to login to your account. - - -Cheers, -Website Administration + + +

Hello {$USERNAME},


+

You have requested a password reset through our online form. In order to complete the request please follow this link:

+

http://{$smarty.server.SERVER_NAME}{$smarty.server.PHP_SELF}?page=password&action=change&token={$TOKEN}

+

You will be asked to change your password. You can then use this new password to login to your account.

+

Cheers,

+

Website Administration

+ +