Properties

$headers

$headers : array

The email headers

Type

array

$htmlBody

$htmlBody : string

The HTML body

Type

string

$textBody

$textBody : string

The text body

Type

string

$altBody

$altBody : string

The alternative body

Type

string

$attachedFiles

$attachedFiles : array

Attached files to mail

As list of filename

Type

array

$subject

$subject : string

The mail subject

Type

string

$mimeBoundary

$mimeBoundary : array

The mime boundary

Type

array

Methods

__construct()

__construct(string  $subject = '', string  $text = '') 

Constructor

Parameters

string $subject

The subject of the mail. Default value is an empty string.

string $text

The body of the message, used as text and html. Default value is an empty string.

setHeader()

setHeader(string  $key, string  $value) 

Set the value of a header

Parameters

string $key

The key of the header to set.

string $value

The new value of the header.

containsFile()

containsFile(string  $filename) : boolean

Check if this file is in the files list

Parameters

string $filename

The file name

Returns

boolean —

True if this file is in the attached files list

containsFiles()

containsFiles() : boolean

Check if the file list contains any file

Returns

boolean —

True if the file list is not empty

Check if the file list is not empty.

addFile()

addFile(string  $filename) 

Add a file to the files list

Parameters

string $filename

The file name

Add $filename to the attached files list.

removeFile()

removeFile(string  $filename) 

Remove a file from the files list

Parameters

string $filename

The file name

Remove $filename from the attached files list.

setSubject()

setSubject(string  $subject) 

Set the subject of the mail

Parameters

string $subject

The new subject

setTEXTBody()

setTEXTBody(string  $body) 

Set the text body of the mail

Parameters

string $body

The new body

setHTMLBody()

setHTMLBody(string  $body) 

Set the html body of the mail

Parameters

string $body

The new body

setText()

setText(string  $text) 

Set the mail content

Parameters

string $text

The new text for the mail contents

Fills Text and HTML bodies from the given text

setAltBody()

setAltBody(string  $body) 

Set the alternative body of the mail

Parameters

string $body

The new body.

setReplyTo()

setReplyTo(string  $email) 

Set the ReplyTo value of the mail

Parameters

string $email

The email address to send this mail

setSender()

setSender(string  $senderEmail, string  $senderName = null, boolean  $allowReply = true) 

Set the Sender value of the mail

Parameters

string $senderEmail

The email address to send this mail

string $senderName

The email address to send this mail. Default value is null.

boolean $allowReply

True to use this address as reply address. Default value is true.

Set the Sender value of the mail. This function also sets the ReplyTo value if undefined. If a sender name is provided, it sets the "From" header to NOM \<EMAIL>

send()

send(string  $toAddress) 

Send the mail to the given address

Parameters

string $toAddress

The email address to send this mail

Send the mail to the given address. You can pass an array of address to send it to multiple recipients.

getBoundary()

getBoundary(integer  $boundaryInd) : string

Get a boundary

Parameters

integer $boundaryInd

The index of the boundary to get. Default value is 0.

Returns

string —

The value of the boundary.

isHTML()

isHTML() : boolean

Check if this mail is a HTML mail

Returns

boolean —

True if this object has a HTML message

isTEXT()

isTEXT() : boolean

Check if this mail is a TEXT mail

Returns

boolean —

True if this object has a TEXT message

isAlternative()

isAlternative() : boolean

Check if this mail is an alternative mail

Returns

boolean —

True if this object has an alternative message

isMultiContent()

isMultiContent() : boolean

Check if this mail contains mutiple contents

Returns

boolean —

True if this object contains multiple contents

is_email()

is_email(string  $email) : boolean

Check if the given mail address is valid

Parameters

string $email

The email address

Returns

boolean —

True if this email is valid

getMimeType()

getMimeType(string  $filename) : string

Get the mime type of a file

Parameters

string $filename

The file name

Returns

string —

The mime type of the file

escape()

escape(string  $string) : string

Escape the string for mails

Parameters

string $string

The string to escape

Returns

string —

The escaped string for mails

escapeB64()

escapeB64(string  $string) : string

Escape the string using base64 encoding

Parameters

string $string

The string to escape

Returns

string —

The escaped string in base64

convHTMLBody()

convHTMLBody(string  $body) : string

Convert body to email-compliant HTML

Parameters

string $body

Returns

string

init()

init() 

Initialize the object