class Service (View source)

Properties

protected Application $app
protected TransportInterface $transport
protected $headers
protected $to
protected $replyto
protected $cc
protected $bcc
protected $from
protected $data
protected $subject
protected $attachments
protected $template
protected $body
protected $bodyHTML
protected $testing

Methods

__construct(Application $app, TransportInterface $transport)

No description

reset()

this method is called by the Loader::helper to clean up the instance of this object resets the class scope variables.

addParameter(string $key, mixed $val)

Adds a parameter to a mail template.

addAttachment(File $file)

Add a File entity as a mail attachment.

addRawAttachment(string $content, string $filename, string $mimetype = 'application/octet-stream')

Add a mail attachment by specifying its raw binary data.

load(string $template, string $pkgHandle = null)

Loads an email template from the /mail/ directory.

setBody(string|false $body)

Manually set the text body of a mail message, typically the body is set in the template + load method.

setSubject(string $subject)

Manually set the message's subject.

string
getSubject()

Returns the message's subject.

string|false
getBody()

Returns the message's text body.

string|false
getBodyHTML()

Returns the message's html body.

setBodyHTML(string|false $html)

manually set the HTML portion of a MIME encoded message, can also be done by setting $bodyHTML in a mail template.

enableMailResponseProcessing(MailImporter $importer, array $data)

No description

string
generateEmailStrings(array $arr)

No description

from(string $email, string $name = null)

Sets the from address on the email about to be sent out.

to(string $email, string $name = null)

Sets to the to email address on the email about to be sent out.

cc(string $email, string $name = null)

Adds an email address to the cc field on the email about to be sent out.

bcc(string $email, string $name = null)

Adds an email address to the bcc field on the email about to be sent out.

replyto($email, $name = null)

No description

setTesting(bool $testing)

Set the testing state (if true the email logging never occurs and sending errors will throw an exception)

bool
getTesting()

Retrieve the testing state

setAdditionalHeaders(array $headers)

Set additional headers.

bool
sendMail(bool $resetData = true)

Sends the email.

static 
getMailerObject() deprecated

No description

Details

__construct(Application $app, TransportInterface $transport)

No description

Parameters

Application $app
TransportInterface $transport

the mail transport to use to send emails

reset()

this method is called by the Loader::helper to clean up the instance of this object resets the class scope variables.

addParameter(string $key, mixed $val)

Adds a parameter to a mail template.

Parameters

string $key
mixed $val

addAttachment(File $file)

Add a File entity as a mail attachment.

Parameters

File $file

addRawAttachment(string $content, string $filename, string $mimetype = 'application/octet-stream')

Add a mail attachment by specifying its raw binary data.

Parameters

string $content

The binary data of the attachemt

string $filename

The name to give to the attachment

string $mimetype

The MIME type of the attachment

load(string $template, string $pkgHandle = null)

Loads an email template from the /mail/ directory.

Parameters

string $template
string $pkgHandle

setBody(string|false $body)

Manually set the text body of a mail message, typically the body is set in the template + load method.

Parameters

string|false $body

Set the text body (false to not use plain text body)

setSubject(string $subject)

Manually set the message's subject.

Parameters

string $subject

string getSubject()

Returns the message's subject.

Return Value

string

string|false getBody()

Returns the message's text body.

Return Value

string|false

string|false getBodyHTML()

Returns the message's html body.

Return Value

string|false

setBodyHTML(string|false $html)

manually set the HTML portion of a MIME encoded message, can also be done by setting $bodyHTML in a mail template.

Parameters

string|false $html

Set the html body (false to not use html body)

enableMailResponseProcessing(MailImporter $importer, array $data)

No description

Parameters

MailImporter $importer
array $data

protected string generateEmailStrings(array $arr)

No description

documentation

Parameters

array $arr

Return Value

string

from(string $email, string $name = null)

Sets the from address on the email about to be sent out.

Parameters

string $email
string $name

to(string $email, string $name = null)

Sets to the to email address on the email about to be sent out.

Parameters

string $email
string $name

cc(string $email, string $name = null)

Since: 5.5.1

Adds an email address to the cc field on the email about to be sent out.

Parameters

string $email
string $name

bcc(string $email, string $name = null)

Since: 5.5.1

Adds an email address to the bcc field on the email about to be sent out.

Parameters

string $email
string $name

replyto($email, $name = null)

No description

Parameters

$email
$name

setTesting(bool $testing)

Set the testing state (if true the email logging never occurs and sending errors will throw an exception)

Parameters

bool $testing

bool getTesting()

Retrieve the testing state

Return Value

bool

setAdditionalHeaders(array $headers)

Set additional headers.

Parameters

array $headers

bool sendMail(bool $resetData = true)

Sends the email.

Parameters

bool $resetData

Whether or not to reset the service to its default values

Return Value

bool

Exceptions

Exception

static getMailerObject() deprecated

deprecated To get the mail transport, call \Core::make(\Zend\Mail\Transport\TransportInterface::class)

No description