Example #1
0
 private function send_forgot_mail()
 {
     date_default_timezone_set('Etc/UTC');
     //Create a new PHPMailer instance
     $mail = new PHPMailer();
     //Tell PHPMailer to use SMTP
     $mail->isSMTP();
     $mail->addAddress($this->user_info['mail'], $this->user_info['fnom'] . '  ' . $this->user_info['lnom']);
     //Set the subject line
     $mail->Subject = 'Demande de réinitialisation du mot de passe Système';
     //Read an HTML message body from an external file, convert referenced images to embedded,
     $Msg_body = file_get_contents(MPATH_MSG . 'forgot.php');
     $Msg_body = str_replace(array('%user_email%', '%url_recovery%'), array($this->user_info['mail'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?_tsk=recovery&token=' . MD5($this->_data['captcha'])), $Msg_body);
     $mail->msgHTML($Msg_body);
     if (!$mail->send()) {
         $this->log .= "Mailer Error: " . $mail->ErrorInfo;
     } else {
         $this->log .= "Un Message avec la procédure de recupération de mot de passe est envoyé à " . $mail->hide_mail($this->user_info['mail']);
     }
 }