diff --git a/html/class_passwordRecovery.inc b/html/class_passwordRecovery.inc index 30a0ab46cd92a61a636101b0222179b117abf979..c91698810ebaa18f81cb75c594cd68f84c839677 100644 --- a/html/class_passwordRecovery.inc +++ b/html/class_passwordRecovery.inc @@ -533,13 +533,7 @@ class passwordRecovery extends standAlonePage { /* Send the mail */ $mail_body = sprintf($this->mail_body, $this->uid, $reinit_link); - /* From */ - $headers = "From: ".$this->from_mail."\r\n"; - $headers .= "Reply-To: ".$this->from_mail."\r\n"; - - $additional_parameters = "-f".$this->from_mail; - - if (mail($this->email_address, $this->mail_subject, $mail_body, $headers, $additional_parameters)) { + if (mail_utf8($this->email_address, FALSE, $this->from_mail, $this->mail_subject, $mail_body)) { $this->step = 3; } else { $this->message[] = msgPool::invalid(_("Contact your administrator, there was a problem with mail server")); @@ -602,13 +596,7 @@ class passwordRecovery extends standAlonePage { /* Send the mail */ $mail_body = sprintf($this->mail2_body, $this->uid); - /* From */ - $headers = "From: ".$this->from_mail."\r\n"; - $headers .= "Reply-To: ".$this->from_mail."\r\n"; - - $additional_parameters = "-f".$this->from_mail; - - if (mail($this->email_address, $this->mail2_subject, $mail_body, $headers, $additional_parameters)) { + if (mail_utf8($this->email_address, FALSE, $this->from_mail, $this->mail2_subject, $mail_body)) { $smarty = get_smarty(); $this->step = 5; $smarty->assign('changed', TRUE); diff --git a/include/functions.inc b/include/functions.inc index 6fbc4204c9959cc435e15bb4f76dccd296901f6b..87af4946afa32c8897c9fb23776583259c121863 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -3442,4 +3442,23 @@ function ldap_escape_dn($str, $ignore = '') { return ldap_escape($str, $ignore, LDAP_ESCAPE_DN); } + +function mail_utf8($to, $from_user, $from_email, $subject, $message) +{ + $subject = "=?UTF-8?B?".base64_encode($subject)."?="; + if ($from_user) { + $from_user = "=?UTF-8?B?".base64_encode($from_user)."?="; + $headers = "From: $from_user <$from_email>\r\n"; + $headers .= "Reply-To: $from_user <$from_email>\r\n"; + } else { + $headers = "From: <$from_email>\r\n"; + $headers .= "Reply-To: <$from_email>\r\n"; + } + $headers .= "MIME-Version: 1.0" . "\r\n" . + "Content-type: text/html; charset=UTF-8" . "\r\n"; + + $additional_parameters = "-f".$from_email; + + return mail($to, $subject, $message, $headers, $additional_parameters); +} ?>