Пример #1
1
 static function send_reset_password($email = null)
 {
     if (Adapter::row_count(Adapter::secure_query('SELECT mail FROM users WHERE mail = :mail', [':mail' => $email])) == 1) {
         $mail = new PHPMailer();
         $mail->IsSMTP();
         $system_settings = unserialize(SYSTEM_SETTINGS);
         $mail->Host = $system_settings['smtp_server'];
         $mail->From = 'admin@azure.gs';
         $mail->FromName = $system_settings['hotel_name'];
         $mail->AddAddress($email);
         $mail->IsHTML(true);
         $mail->Subject = 'Reset-Password Confirmation';
         $mail->Body = Page::include_content('reset_password', 'others/mail');
         $get_details = Adapter::fetch_object(Adapter::secure_query('SELECT id,username,mail FROM users WHERE mail = :mail', [':mail' => $email]));
         $mail->Body = str_replace('{{mail_username}}', $get_details->username, $mail->Body);
         $mail->Body = str_replace('{{mail_email}}', $get_details->mail, $mail->Body);
         $hash = md5($get_details->mail . '_' . $get_details->username . '_' . rand(0, 9));
         Adapter::secure_query('INSERT INTO cms_restore_password (user_id,user_hash) VALUES (:userid,:userhash)', [':userid' => $get_details->id, ':userhash' => $hash]);
         $mail->Body = str_replace('{{confirm_url}}', $system_settings['global_url'] . '/reset-password/' . $hash, $mail->Body);
         $mail->Body = str_replace('{{hotel_name}}', $system_settings['hotel_name'], $mail->Body);
         $mail->Send();
         $mail->ClearAllRecipients();
         $mail->ClearAttachments();
     }
 }
 private function renderMail(WorkingDay $day)
 {
     $this->mailClient->Subject = $this->template->renderSubject($day);
     $this->mailClient->Body = $this->template->renderBody($day);
     $this->mailClient->IsHTML(true);
 }