\CogiMail

CogiMail - PHP email creation and transport class.

Summary

Methods
Properties
Constants
__construct()
addRecipientEmail()
addBccRecipientMail()
addFile()
contentMail()
debugMail()
sendMail()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
_isEmail()
$_senderName
$_senderMail
$_replyToMail
$_recipientsMails
$_bccMails
$_mailObject
$_mailPlainText
$_mailHtml
$_mailFiles
$_message
$_frontier
$_headers
N/A

Properties

$_senderName

$_senderName : string

Name of the sender

Type

string

$_senderMail

$_senderMail : string

Email of the sender

Type

string

$_replyToMail

$_replyToMail : string

Email for reply to

Type

string

$_recipientsMails

$_recipientsMails : string

Recipients mails list (separated by ;)

Type

string

$_bccMails

$_bccMails : string

Recipients bcc mails list (separated by ;)

Type

string

$_mailObject

$_mailObject : string

Email object

Type

string

$_mailPlainText

$_mailPlainText : string

Email content in plain text

Type

string

$_mailHtml

$_mailHtml : string

Email content in html formated text

Type

string

$_mailFiles

$_mailFiles : string

Files list to join the email (separated by ;)

Type

string

$_message

$_message : string

Message built to be send

Type

string

$_frontier

$_frontier : string

Frontier to separate the different parts of the content

Type

string

$_headers

$_headers : string

Headers of the email

Type

string

Methods

__construct()

__construct(string  $senderMail, string  $senderName, string  $replyToMail = "") : void

Constructor.

Initialize the component with the sender informations.

Parameters

string $senderMail

Email of the sender.

string $senderName

Name of the sender.

string $replyToMail

(optional) Email for reply to.

Throws

\InvalidArgumentException

If the sender mail or replyto mail is invalid.

addRecipientEmail()

addRecipientEmail(string  $mail) : void

Add a recipient email.

Add a recipient email to the recipients list.

Parameters

string $mail

Email of the recipient to add.

Throws

\InvalidArgumentException

If the recipient mail is invalid.

addBccRecipientMail()

addBccRecipientMail(string  $mail) : void

Add a bcc recipient email.

Add a bcc recipient email to the bcc recipients list.

Parameters

string $mail

Email of the bcc recipient to add.

Throws

\InvalidArgumentException

If the bcc recipient mail is invalid.

addFile()

addFile(string  $fileUrl) : void

Add a file to join to the email.

Add a file to the files list to join to the email. File type could be jpg, jpeg, gif, png, pdf, doc, and others

Parameters

string $fileUrl

Url of the file to add to the list.

Throws

\InvalidArgumentException

If the file url does not exist.

contentMail()

contentMail(string  $mailObject, string  $mailPlainText, string  $mailHtml) : void

Initialize the content of the email.

Initialize the content of the email : object, text, html text.

Parameters

string $mailObject

The object of the email.

string $mailPlainText

The plain text of the email.

string $mailHtml

The html text of the email.

debugMail()

debugMail() : void

Email debug.

Display a formated dump of the email object.

sendMail()

sendMail() : void

Send the email.

Send the email with the data initialized.

Throws

\InvalidArgumentException

If the cannot be sent.

_isEmail()

_isEmail(string  $email) : boolean

Email validation.

Return true or false if the email is valid or not

Parameters

string $email

Email to be validated

Returns

boolean