Properties

$ident

$ident : string

The queue item ID.

Type

string

$to

$to : string

The recipient's email address.

Type

string

$from

$from : string

The sender's email address.

Type

string

$subject

$subject : string

The email subject.

Type

string

$msgHtml

$msgHtml : string

The HTML message body.

Type

string

$msgTxt

$msgTxt : string

The plain-text message body.

Type

string

$campaign

$campaign : string

The campaign ID.

Type

string

$emailFactory

$emailFactory : \Charcoal\Factory\FactoryInterface

Type

\Charcoal\Factory\FactoryInterface

Methods

setDependencies()

setDependencies(\Pimple\Container  $container) : void

Parameters

\Pimple\Container $container

Pimple DI container.

key()

key() : string

Get the primary key that uniquely identifies each queue item.

Returns

string

setIdent()

setIdent(string|null  $ident) : \Charcoal\Email\AbstractMessage

Set the queue item's ID.

Parameters

string|null $ident

The unique queue item identifier.

Throws

\InvalidArgumentException

If the identifier is not a string.

Returns

\Charcoal\Email\AbstractMessage —

Chainable

ident()

ident() : string

Get the queue item's ID.

Returns

string

setTo()

setTo(string|array  $email) : \Charcoal\Email\EmailQueueItem

Set the recipient's email address.

Parameters

string|array $email

An email address.

Throws

\InvalidArgumentException

If the email address is invalid.

Returns

\Charcoal\Email\EmailQueueItem

Chainable

to()

to() : string

Get the recipient's email address.

Returns

string

setFrom()

setFrom(string|array  $email) : \Charcoal\Email\EmailQueueItem

Set the sender's email address.

Parameters

string|array $email

An email address.

Throws

\InvalidArgumentException

If the email address is invalid.

Returns

\Charcoal\Email\EmailQueueItem

Chainable

from()

from() : string

Get the sender's email address.

Returns

string

setSubject()

setSubject(string  $subject) : \Charcoal\Email\EmailQueueItem

Set the email subject.

Parameters

string $subject

The email subject.

Throws

\InvalidArgumentException

If the subject is not a string.

Returns

\Charcoal\Email\EmailQueueItem

Chainable

subject()

subject() : string

Get the email subject.

Returns

string

setMsgHtml()

setMsgHtml(string  $body) : \Charcoal\Email\EmailQueueItem

Set the email's HTML message body.

Parameters

string $body

The HTML message body.

Throws

\InvalidArgumentException

If the message is not a string.

Returns

\Charcoal\Email\EmailQueueItem

Chainable

msgHtml()

msgHtml() : string

Get the email's HTML message body.

Returns

string

setMsgTxt()

setMsgTxt(string  $body) : \Charcoal\Email\EmailQueueItem

Set the email's plain-text message body.

Parameters

string $body

The plain-text mesage body.

Throws

\InvalidArgumentException

If the message is not a string.

Returns

\Charcoal\Email\EmailQueueItem

Chainable

msgTxt()

msgTxt() : string

Get the email's plain-text message body.

Returns

string

setCampaign()

setCampaign(string  $campaign) : \Charcoal\Email\EmailQueueItem

Set the campaign ID.

Parameters

string $campaign

The campaign identifier.

Throws

\InvalidArgumentException

If the campaign is not a string.

Returns

\Charcoal\Email\EmailQueueItem

Chainable

campaign()

campaign() : string

Get the campaign ID.

If it has not been explicitely set, it will be auto-generated (with uniqid).

Returns

string

process()

process(callable  $callback = null, callable  $successCallback = null, callable  $failureCallback = null) : boolean

Process the item.

Parameters

callable $callback

An optional callback routine executed after the item is processed.

callable $successCallback

An optional callback routine executed when the item is resolved.

callable $failureCallback

An optional callback routine executed when the item is rejected.

Returns

boolean —

Success / Failure

preSave()

preSave() : boolean

Hook called before saving the item.

Returns

boolean

emailToArray()

emailToArray(mixed  $var) : string

Convert an email address (RFC822) into a proper array notation.

Parameters

mixed $var

An email array (containing an "email" key and optionally a "name" key).

Throws

\InvalidArgumentException

If the email is invalid.

Returns

string

emailFromArray()

emailFromArray(array  $arr) : string

Convert an email address array to a RFC-822 string notation.

Parameters

array $arr

An email array (containing an "email" key and optionally a "name" key).

Throws

\InvalidArgumentException

If the email array is invalid.

Returns

string

setEmailFactory()

setEmailFactory(\Charcoal\Factory\FactoryInterface  $factory) : \Charcoal\Email\EmailQueueItem

Parameters

\Charcoal\Factory\FactoryInterface $factory

The factory to create email objects.

Returns

\Charcoal\Email\EmailQueueItem

Chainable

emailFactory()

emailFactory() : \Charcoal\Factory\FactoryInterface

Returns

\Charcoal\Factory\FactoryInterface