MailManager

Extends \org\turbocommons\src\main\php\model\BaseStrictClass

Class that acts as an interface to email sending operations

package

Default

Methods

Protection to prevent accessing undefined properties to this class

__get(string $name) : void
inherited

Arguments

$name

string

The property name

Protection to prevent creating extra properties to this class

__set(string $name, string $value) : void
inherited

Arguments

$name

string

The property name

$value

string

The property value

Attach a file from binary data to the email

attachFile(string $filename,  $fileData) : void

Arguments

$filename

string

The name for the file when sent on the email

$fileData

Send the email, with the currently specified parameters. Note that if we want to attach files to the mail we must do it before calling the send method.

sendMail(string $senderAddress, array|string $receiverAddress, string $subject, string $message, boolean $htmlMode = false, string $encoding = 'UTF8', boolean $dispositionRequire = false) : boolean

Arguments

$senderAddress

string

The addres for the person who sends the email. If you want to set a custom sender name also than the email, use : My custom sender name mi@email.com

$receiverAddress

array|string

The address where the email will be sent, or an array containing a list of adresses where the mail will be sent

$subject

string

Title for the message to send

$message

string

Message body

$htmlMode

boolean

Enable when sending html content. Disabled by default

$encoding

string

The charset that is defined when sending the email. MailManager::UTF-8 by default. It is VERY important to make sure that the subject and message parameters are passed with the same encoding as the one defined here, otherwise strange characters will appear on the received email.

$dispositionRequire

boolean

Request notification when the email is read by the receiver. False by default

Response

boolean

True if the mail was queued to be sent (does not mean it will reach its destination), False if the mail could not be delivered.