Documentation

CMail
in package

Class to manage the sending of emails. It needs phpmailer to be used.

Tags

Table of Contents

$mailer  : PHPMailer
__construct()  : mixed
__construct
addAttachment()  : void
Add a file attached to the email
addBCC()  : void
Adds an email address and name to send a copy to (the name will NOT appear to other recipients)
addCC()  : void
Adds an email address and name to send a copy to (the name will also appear to other recipients)
send()  : string
Send an email with all necessary parameters
sendFromtemplate()  : string
Send an email with all necessary parameters using a template
setFrom()  : void
Set the email and the name of the sender
setReplyTo()  : void
Set the email address and name to send any reply to

Properties

Methods

__construct()

__construct

public __construct() : mixed
Tags
Return values
mixed

addAttachment()

Add a file attached to the email

public addAttachment(string $filePath) : void
Parameters
$filePath : string

the path of file in the server

Tags
Return values
void

addBCC()

Adds an email address and name to send a copy to (the name will NOT appear to other recipients)

public addBCC(string $email[, string $name = '' ]) : void
Parameters
$email : string

email address to add the copy to the recipient

$name : string = ''

name to add the copy to the recipient (can be empty or not declared)

Tags
Return values
void

addCC()

Adds an email address and name to send a copy to (the name will also appear to other recipients)

public addCC(string $email[, string $name = '' ]) : void
Parameters
$email : string

email address to add the copy to the recipient

$name : string = ''

name to add the copy to the recipient (can be empty or not declared)

Tags
Return values
void

send()

Send an email with all necessary parameters

public send(string $email, string $name, string $subject, string $body_html[, string $body_text = '' ]) : string
Parameters
$email : string

email address to add the copy to the recipient

$name : string

name to add the copy to the recipient (can be empty or not declared)

$subject : string

The title of the email

$body_html : string

The body of the message in HTML format

$body_text : string = ''

The body of the message in plain text format

Tags
Return values
string

the reply message after sending

sendFromtemplate()

Send an email with all necessary parameters using a template

public sendFromtemplate(string $email, string $name, string $template[, array<string, string>|null $replaces = null ]) : string
Parameters
$email : string

email address to add the copy to the recipient

$name : string

name to add the copy to the recipient (can be empty or not declared)

$template : string

the template with [TAGS] to change with relative parameters inside $replaces

$replaces : array<string, string>|null = null

associative array containing the list of values ​​that replace the template TAGS ([TAG]=>Value)

Tags
Return values
string

the reply message after sending

setFrom()

Set the email and the name of the sender

public setFrom(string $email[, string $name = '' ]) : void
Parameters
$email : string

the email of sender

$name : string = ''

the name of sender (can be empty or not declared)

Tags
Return values
void

setReplyTo()

Set the email address and name to send any reply to

public setReplyTo(string $email[, string $name = '' ]) : void
Parameters
$email : string

the email address to reply to the email if necessary

$name : string = ''

the name to reply (can be empty or not declared)

Tags
Return values
void

        

Search results