User Detail - warwickfoster/qurantools GitHub Wiki

File: app/library/mail_functions.php

Purpose

The PHP code you provided is a collection of functions for sending emails within the Qur'an Tools (QT) application. These functions are responsible for password resets, error notifications, and general messages to the QT admin.

Functions

  • generate_password_reset_email_HTML(): Creates an HTML email message for password reset requests.
  • process_password_reset_email(): Sends the password reset email to the specified user.
  • email_error_to_qt(): Emails errors requiring developer attention to the QT admin.
  • email_qt(): Sends general messages to the QT admin.

Constants

  • SUBJECT_MESSAGE_FROM_QT_SYSTEM: Subject for messages from the QT system.
  • SUBJECT_QT_APPLICATION_ERROR: Subject for QT application errors.
  • SUBJECT_RECAPTCHA_NOT_ATTEMPTED: Subject for reCAPTCHA attempt not made.
  • SUBJECT_RECAPTCHA_ERROR: Subject for reCAPTCHA errors.
  • SUBJECT_RECAPTCHA_FAIL_REGISTER_INTEREST: Subject for reCAPTCHA failure during registration interest.
  • PASSWORD_RESET_SUBJECT: Subject for password reset emails.

Usage

The functions can be used as follows:

Password Reset

$reset_link = "your_reset_link";
$message = generate_password_reset_email_HTML("Bob Smith", $reset_link);
process_password_reset_email("[email protected]", $message);

Error Notification

email_error_to_qt($exception, "Extra error message");

General Message

email_qt("Your message here");

Note

  • The QT_ADMIN_EMAIL constant should be set to the actual email address of the QT admin.
  • The config['qt_developers'] variable should contain a list of email addresses for the QT developers.
  • The mail() function is used to send emails, and it requires the necessary email configuration.