Service
class Service (View source)
Properties
protected Application | $app | The application instance. |
|
protected TransportInterface | $transport | The transport to be used to delivery the messages. |
|
protected array | $headers | Additional email message headers. |
|
protected | $to | List of "To" recipients (every item is an array with at key 0 the email address and at key 1 an optional name). |
|
protected | $replyto | List of "Reply-To" recipients (every item is an array with at key 0 the email address and at key 1 an optional name). |
|
protected | $cc | List of "CC" recipients (every item is an array with at key 0 the email address and at key 1 an optional name). |
|
protected | $bcc | List of "CC" recipients (every item is an array with at key 0 the email address and at key 1 an optional name). |
|
protected string[] | $from | The sender email address and its name. |
|
protected array | $data | A dictionary with the parameters to be sent to the template. |
|
protected string | $subject | The message subject. |
|
protected Part[] | $attachments | The message attachments. |
|
protected string | $template | The last leaded message template file. |
|
protected string|false | $body | The plain text body. |
|
protected string|false | $bodyHTML | The HTML body. |
|
protected bool | $testing | Are we testing this service? |
|
protected false | $throwOnFailure | Should we throw an exception if the delivery fails? |
Methods
No description
Clean up the instance of this object (reset the class scope variables).
Adds a parameter for the mail template.
Add a File entity as an attachment of the message, specifying the headers of the mail MIME part.
Add a mail attachment by specifying its raw binary data.
Add a mail attachment by specifying its raw binary data, specifying the headers of the mail MIME part.
Load an email template from the /mail/ directory.
Manually set the plain text body of a mail message (typically the body is set in the template + load method).
Manually set the message's subject (typically the body is set in the template + load method).
Get the message subject.
Get the plain text body.
Get the html body.
Manually set the HTML body of a mail message (typically the body is set in the template + load method).
Set the from address on the message.
Add one or more "To" recipients to the message.
Add one or more "CC" recipients to the message.
Add one or more "BCC" recipients to the message.
Sets the Reply-To addresses of the message.
Set the testing state (if true the email logging never occurs and sending errors will throw an exception).
Retrieve the testing state.
Should an exception be thrown if the delivery fails (if false, the sendMail() method will simply return false on failure).
Should an exception be thrown if the delivery fails (if false, the sendMail() method will simply return false on failure).
Set additional message headers.
Sends the email.
Convert a list of email addresses to a string.
Get the MIME part for the plain text body (if available).
Determine if an attachment should be used as an inline attachment associated to the HTML body.
Get the MIME part for the plain text body (if available).
Details
__construct(Application $app, TransportInterface $transport)
Initialize the instance.
__destruct()
No description
reset()
Clean up the instance of this object (reset the class scope variables).
addParameter(string $key, mixed $val)
Adds a parameter for the mail template.
addAttachment(File $file)
Add a File entity as an attachment of the message.
addAttachmentWithHeaders(File $file, array $headers)
Add a File entity as an attachment of the message, specifying the headers of the mail MIME part.
addRawAttachment(string $content, string $filename, string $mimetype = 'application/octet-stream')
Add a mail attachment by specifying its raw binary data.
addRawAttachmentWithHeaders(string $content, string $filename, array $headers = [])
Add a mail attachment by specifying its raw binary data, specifying the headers of the mail MIME part.
load(string $template, string|null $pkgHandle = null)
Load an email template from the /mail/ directory.
setBody(string|false $body)
Manually set the plain 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 (typically the body is set in the template + load method).
string
getSubject()
Get the message subject.
string|false
getBody()
Get the plain text body.
string|false
getBodyHTML()
Get the html body.
setBodyHTML(string|false $html)
Manually set the HTML body of a mail message (typically the body is set in the template + load method).
enableMailResponseProcessing(MailImporter $importer, array $data)
No description
from(string $email, string|null $name = null)
Set the from address on the message.
to(string $email, string|null $name = null)
Add one or more "To" recipients to the message.
cc(string $email, string|null $name = null)
Add one or more "CC" recipients to the message.
bcc(string $email, string|null $name = null)
Add one or more "BCC" recipients to the message.
replyto(string $email, string|null $name = null)
Sets the Reply-To addresses of the message.
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.
$this
setIsThrowOnFailure(bool $throwOnFailure)
Should an exception be thrown if the delivery fails (if false, the sendMail() method will simply return false on failure).
bool
isThrowOnFailure()
Should an exception be thrown if the delivery fails (if false, the sendMail() method will simply return false on failure).
setAdditionalHeaders(array $headers)
Set additional message headers.
bool
sendMail(bool $resetData = true)
Sends the email.
static
getMailerObject()
deprecated
deprecated
No description
protected string
generateEmailStrings(array $arr)
Convert a list of email addresses to a string.
protected Part|null
buildTextPart()
Get the MIME part for the plain text body (if available).
protected bool
isInlineAttachment(Part $attachment)
Determine if an attachment should be used as an inline attachment associated to the HTML body.
protected Part|null
buildHtmlPart()
Get the MIME part for the plain text body (if available).