tab_mail
    
            
            in package
            
        
    
    
    
Class tab_mail
Represents a class for managing email records in the database.
Table of Contents
Properties
- $allowedcols : array<string|int, mixed>
 - $db : db_master
 
Methods
- __construct() : mixed
 - Constructs a new instance of the class.
 - __destruct() : void
 - Destructor method for the current class.
 - all() : array<string|int, mixed>|bool
 - Retrieves all the records from the 'mail' table and returns them.
 - delete() : bool
 - Deletes a record from the `mail` table based on the specified column and value.
 - get() : array<string|int, mixed>|bool
 - Retrieves a record from the 'mail' table based on the specified value and column and returns it.
 - getall() : array<string|int, mixed>|bool
 - insert() : string|bool
 - Inserts a new record into the 'mail' table with the given parameters.
 - update() : bool
 - Updates a record in the `mail` table with the specified column, new value, and mail id.
 
Properties
$allowedcols
    protected
        array<string|int, mixed>
    $allowedcols
     = ['id', 'tenant', 'created', 'to', 'cc', 'bcc', 'subject', 'html_body', 'text_body', 'send', 'sendtime']
    
        This variable is an array that contains the allowed columns for a specific operation. Each element of this array represents a column name.
Usage example: $allowedcols = ['id','created','to','cc','bcc','subject','html_body','text_body','send'];
$db
    protected
        db_master
    $db
    
    
        This variable represents the connection to the database.
Methods
__construct()
Constructs a new instance of the class.
    public
                    __construct() : mixed
    Initializes the database object by assigning the global $dbm variable to the local $this->db property.
__destruct()
Destructor method for the current class.
    public
                    __destruct() : void
    Unsets the 'db' and 'allowedcols' properties.
all()
Retrieves all the records from the 'mail' table and returns them.
    public
                    all([string $sort = 'send' ]) : array<string|int, mixed>|bool
    Optionally, you can specify the column to sort the records by.
Parameters
- $sort : string = 'send'
 - 
                    
(Optional) The column to sort the records by. Defaults to 'send'.
 
Return values
array<string|int, mixed>|bool —Returns an array of all the records from the 'mail' table if successful, false otherwise.
delete()
Deletes a record from the `mail` table based on the specified column and value.
    public
                    delete(string $val[, string $col = 'id' ]) : bool
    Parameters
- $val : string
 - 
                    
The value to match against the specified column.
 - $col : string = 'id'
 - 
                    
The column to be used for the deletion. Defaults to 'id'.
 
Return values
bool —Returns true if the deletion was successful, false otherwise.
get()
Retrieves a record from the 'mail' table based on the specified value and column and returns it.
    public
                    get(string $val[, string $col = 'id' ]) : array<string|int, mixed>|bool
    Parameters
- $val : string
 - 
                    
The value to match the records against.
 - $col : string = 'id'
 - 
                    
(Optional) The column to match the value against. Defaults to 'id'.
 
Return values
array<string|int, mixed>|bool —Returns an array of the matching record from the 'mail' table if successful, false otherwise.
getall()
    public
                    getall(string $val[, string $col = 'id' ]) : array<string|int, mixed>|bool
    Parameters
- $val : string
 - $col : string = 'id'
 
Return values
array<string|int, mixed>|boolinsert()
Inserts a new record into the 'mail' table with the given parameters.
    public
                    insert(string $tid, string $to, string $cc, string $bcc, string $subject, string $htmlbody, string $textbody) : string|bool
    Parameters
- $tid : string
 - $to : string
 - 
                    
The email address of the recipient.
 - $cc : string
 - 
                    
(Optional) The email address(es) of the CC recipient(s).
 - $bcc : string
 - 
                    
(Optional) The email address(es) of the BCC recipient(s).
 - $subject : string
 - 
                    
The subject of the email.
 - $htmlbody : string
 - 
                    
The HTML body of the email.
 - $textbody : string
 - 
                    
The plain text body of the email.
 
Return values
string|bool —Returns the ID of the newly inserted record if successful, false otherwise.
update()
Updates a record in the `mail` table with the specified column, new value, and mail id.
    public
                    update(string $col, string $val, string $mid) : bool
    Parameters
- $col : string
 - 
                    
The column to be updated.
 - $val : string
 - 
                    
The new value for the specified column.
 - $mid : string
 - 
                    
The mail id of the record to be updated.
 
Return values
bool —Returns true if the update was successful, false otherwise.