Documentation

Mailer
in package

Mailer basic class.

Tags
copyright

YetiForce Sp. z o.o

license

YetiForce Public License 4.0 (licenses/LicenseEN.txt or yetiforce.com)

author

Mariusz Krzaczkowski m.krzaczkowski@yetiforce.com

Table of Contents

$error  : array<string|int, mixed>
$quoteColumn  : array<string|int, string>
$quoteJsonColumn  : array<string|int, string>
$statuses  : array<string|int, string>
$mailer  : PHPMailer
$params  : array<string|int, mixed>
$smtp  : array<string|int, mixed>
__construct()  : mixed
Construct.
addMail()  : bool
Add mail to quote for send.
attachment()  : $this
Add an attachment from a path on the filesystem.
bcc()  : $this
Add a "BCC" address.
cc()  : $this
Add a "CC" address.
cloneMailer()  : Mailer
Clone the mailer object for individual shipment.
content()  : $this
Creates a message from an HTML string, making modifications for inline images and backgrounds and creates a plain-text version by converting the HTML.
from()  : $this
Set the From and FromName properties.
getCustomParams()  : array<string|int, mixed>
Get additional parameters.
getSmtp()  : mixed
Get configuration smtp.
insertMail()  : void
Save mail data in provided table.
loadSmtp()  : $this
Load configuration smtp.
loadSmtpByID()  : $this
Load configuration smtp by id.
replyTo()  : $this
Add a "Reply-To" address.
saveMail()  : bool
Save sent email.
send()  : bool
Create a message and send it.
sendByRowQueue()  : bool
Send mail by row queue.
sendFromTemplate()  : bool
setCustomParams()  : void
Adding additional parameters.
setSmtp()  : void
Set configuration smtp in mailer.
subject()  : $this
Set subject.
test()  : array<string|int, mixed>
Check connection.
to()  : $this
Add a "To" address.

Properties

$error

public static array<string|int, mixed> $error

Error logs

$quoteColumn

public static array<string|int, string> $quoteColumn = ['smtp_id', 'date', 'owner', 'status', 'from', 'subject', 'content', 'to', 'cc', 'bcc', 'attachments', 'priority']

Columns list available in the database

$quoteJsonColumn

public static array<string|int, string> $quoteJsonColumn = ['from', 'to', 'cc', 'bcc', 'attachments', 'params']

Columns list that require JSON formatting

$statuses

public static array<string|int, string> $statuses = [0 => 'LBL_PENDING_ACCEPTANCE', 1 => 'LBL_WAITING_TO_BE_SENT', 2 => 'LBL_ERROR_DURING_SENDING']

Queue status

$mailer

protected PHPMailer $mailer

PHPMailer instance

$params

protected array<string|int, mixed> $params = []

Parameters for sending messages

$smtp

protected array<string|int, mixed> $smtp

SMTP configuration

Methods

__construct()

Construct.

public __construct() : mixed
Return values
mixed

addMail()

Add mail to quote for send.

public static addMail(array<string|int, mixed> $params) : bool
Parameters
$params : array<string|int, mixed>
Return values
bool

attachment()

Add an attachment from a path on the filesystem.

public attachment(string $path[, string $name = '' ]) : $this
Parameters
$path : string

Path to the attachment

$name : string = ''

Overrides the attachment name

Return values
$this

mailer object itself

bcc()

Add a "BCC" address.

public bcc(string $address[, string $name = '' ]) : $this
Parameters
$address : string

The email address to send to

$name : string = ''
Tags
note:

This function works with the SMTP mailer on win32, not with the "mail" mailer.

Return values
$this

mailer object itself

cc()

Add a "CC" address.

public cc(string $address[, string $name = '' ]) : $this
Parameters
$address : string

The email address to send to

$name : string = ''
Tags
note:

This function works with the SMTP mailer on win32, not with the "mail" mailer.

Return values
$this

mailer object itself

cloneMailer()

Clone the mailer object for individual shipment.

public cloneMailer() : Mailer
Return values
Mailer

content()

Creates a message from an HTML string, making modifications for inline images and backgrounds and creates a plain-text version by converting the HTML.

public content(text $message) : $this
Parameters
$message : text
Tags
see
PHPMailer::MsgHTML()
Return values
$this

mailer object itself

from()

Set the From and FromName properties.

public from(string $address[, string $name = '' ]) : $this
Parameters
$address : string
$name : string = ''
Return values
$this

mailer object itself

getCustomParams()

Get additional parameters.

public getCustomParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSmtp()

Get configuration smtp.

public getSmtp([string|null $key = null ]) : mixed
Parameters
$key : string|null = null
Return values
mixed

insertMail()

Save mail data in provided table.

public static insertMail(array<string|int, mixed> $params, string $type) : void
Parameters
$params : array<string|int, mixed>
$type : string

'admin' | 'log'

Return values
void

loadSmtp()

Load configuration smtp.

public loadSmtp(array<string|int, mixed> $smtpInfo) : $this
Parameters
$smtpInfo : array<string|int, mixed>
Return values
$this

mailer object itself

loadSmtpByID()

Load configuration smtp by id.

public loadSmtpByID(int $smtpId) : $this
Parameters
$smtpId : int

Smtp ID

Return values
$this

mailer object itself

replyTo()

Add a "Reply-To" address.

public replyTo(string $address[, string $name = '' ]) : $this
Parameters
$address : string

The email address to reply to

$name : string = ''
Return values
$this

mailer object itself

saveMail()

Save sent email.

public saveMail() : bool
Tags
throws
AppException
Return values
bool

send()

Create a message and send it.

public send() : bool
Return values
bool

sendByRowQueue()

Send mail by row queue.

public static sendByRowQueue(array<string|int, mixed> $rowQueue) : bool
Parameters
$rowQueue : array<string|int, mixed>
Return values
bool

sendFromTemplate()

public static sendFromTemplate(array<string|int, mixed> $params) : bool
Parameters
$params : array<string|int, mixed>
Return values
bool

setCustomParams()

Adding additional parameters.

public setCustomParams(array<string|int, mixed> $params) : void
Parameters
$params : array<string|int, mixed>
Return values
void

setSmtp()

Set configuration smtp in mailer.

public setSmtp() : void
Return values
void

subject()

Set subject.

public subject(string $subject) : $this
Parameters
$subject : string
Return values
$this

mailer object itself

test()

Check connection.

public test() : array<string|int, mixed>
Return values
array<string|int, mixed>

to()

Add a "To" address.

public to(string $address[, string $name = '' ]) : $this
Parameters
$address : string

The email address to send to

$name : string = ''
Return values
$this

mailer object itself


        

Search results