Mailer
in package
Weaver Framework - Mailer Class
This class provides functionality for adding emails to the mail broker and sending them. It also handles the creation of the mail_broker table if it doesn't exist.
NOTE: send() function is dependent on Libraries/Mail.py
Table of Contents
Properties
- $db : mixed
Methods
- __construct() : mixed
- Constructor
- add() : bool
- Add Email to Mail Broker
- send() : mixed
- Send All Pending Emails
- initialize() : mixed
- Initialize - Create Mail Broker Table
Properties
$db
private
mixed
$db
Methods
__construct()
Constructor
public
__construct() : mixed
Initializes the Mailer object and creates the mail_broker table if it doesn't exist.
add()
Add Email to Mail Broker
public
add(string $email, string $subject, string $message) : bool
Adds an email to the mail broker for later sending.
Parameters
- $email : string
-
The recipient's email address.
- $subject : string
-
The subject of the email.
- $message : string
-
The email message content.
Return values
bool —True if the email was added successfully, false otherwise.
send()
Send All Pending Emails
public
send() : mixed
Retrieves all pending emails from the mail_broker table and sends them.
initialize()
Initialize - Create Mail Broker Table
private
initialize() : mixed
Creates the mail_broker table in the database if it doesn't already exist. Ensures that the table structure is secure.