NotificationEmail
extends TemplatedEmail
in package
Tags
Table of Contents
Constants
- IMPORTANCE_HIGH = 'high'
- IMPORTANCE_LOW = 'low'
- IMPORTANCE_MEDIUM = 'medium'
- IMPORTANCE_URGENT = 'urgent'
- PRIORITY_HIGH = 2
- PRIORITY_HIGHEST = 1
- PRIORITY_LOW = 4
- PRIORITY_LOWEST = 5
- PRIORITY_NORMAL = 3
- PRIORITY_MAP = [self::PRIORITY_HIGHEST => 'Highest', self::PRIORITY_HIGH => 'High', self::PRIORITY_NORMAL => 'Normal', self::PRIORITY_LOW => 'Low', self::PRIORITY_LOWEST => 'Lowest']
Properties
- $attachments : array<string|int, mixed>
- $body : mixed
- $cachedBody : AbstractPart|null
- $context : array<string|int, mixed>
- $headers : mixed
- $html : resource|string|null
- $htmlCharset : string|null
- $htmlTemplate : string|null
- $message : mixed
- $text : resource|string|null
- $textCharset : string|null
- $textTemplate : string|null
- $theme : string
Methods
- __clone() : mixed
- __construct() : mixed
- __serialize() : array<string|int, mixed>
- __unserialize() : void
- action() : $this
- addBcc() : $this
- addCc() : $this
- addFrom() : $this
- addReplyTo() : $this
- addTo() : $this
- asPublicEmail() : self
- Creates a NotificationEmail instance that is appropriate to send to normal (non-admin) users.
- attach() : $this
- attachFromPath() : $this
- attachPart() : $this
- bcc() : $this
- cc() : $this
- content() : $this
- context() : $this
- date() : $this
- embed() : $this
- embedFromPath() : $this
- ensureValidity() : mixed
- exception() : $this
- from() : $this
- generateMessageId() : string
- getAttachments() : array<string|int, mixed>|array<string|int, DataPart>
- getBcc() : array<string|int, Address>
- getBody() : AbstractPart|null
- getCc() : array<string|int, Address>
- getContext() : array<string|int, mixed>
- getDate() : DateTimeImmutable|null
- getFrom() : array<string|int, Address>
- getHeaders() : Headers
- getHtmlBody() : resource|string|null
- getHtmlCharset() : string|null
- getHtmlTemplate() : string|null
- getPreparedHeaders() : Headers
- getPriority() : int
- Get the priority of this message.
- getReplyTo() : array<string|int, Address>
- getReturnPath() : Address|null
- getSender() : Address|null
- getSubject() : string|null
- getTextBody() : resource|string|null
- getTextCharset() : string|null
- getTextTemplate() : string|null
- getTo() : array<string|int, Address>
- html() : $this
- htmlTemplate() : $this
- importance() : $this
- markAsPublic() : $this
- markdown() : $this
- priority() : $this
- Sets the priority of this message.
- replyTo() : $this
- returnPath() : $this
- sender() : $this
- setBody() : $this
- setHeaders() : $this
- subject() : $this
- text() : $this
- textTemplate() : $this
- theme() : $this
- to() : $this
- toIterable() : iterable<string|int, mixed>
- toString() : string
- addListAddressHeaderBody() : mixed
- createDataPart() : DataPart
- determinePriority() : int
- generateBody() : AbstractPart
- Generates an AbstractPart based on the raw body of a message.
- getExceptionAsString() : string
- prepareParts() : array<string|int, mixed>|null
- setHeaderBody() : $this
- setListAddressHeaderBody() : $this
Constants
IMPORTANCE_HIGH
public
mixed
IMPORTANCE_HIGH
= 'high'
IMPORTANCE_LOW
public
mixed
IMPORTANCE_LOW
= 'low'
IMPORTANCE_MEDIUM
public
mixed
IMPORTANCE_MEDIUM
= 'medium'
IMPORTANCE_URGENT
public
mixed
IMPORTANCE_URGENT
= 'urgent'
PRIORITY_HIGH
public
mixed
PRIORITY_HIGH
= 2
PRIORITY_HIGHEST
public
mixed
PRIORITY_HIGHEST
= 1
PRIORITY_LOW
public
mixed
PRIORITY_LOW
= 4
PRIORITY_LOWEST
public
mixed
PRIORITY_LOWEST
= 5
PRIORITY_NORMAL
public
mixed
PRIORITY_NORMAL
= 3
PRIORITY_MAP
private
mixed
PRIORITY_MAP
= [self::PRIORITY_HIGHEST => 'Highest', self::PRIORITY_HIGH => 'High', self::PRIORITY_NORMAL => 'Normal', self::PRIORITY_LOW => 'Low', self::PRIORITY_LOWEST => 'Lowest']
Properties
$attachments
private
array<string|int, mixed>
$attachments
= []
$body
private
mixed
$body
$cachedBody
private
AbstractPart|null
$cachedBody
= null
$context
private
array<string|int, mixed>
$context
= ['importance' => self::IMPORTANCE_LOW, 'content' => '', 'exception' => false, 'action_text' => null, 'action_url' => null, 'markdown' => false, 'raw' => false, 'footer_text' => 'Notification e-mail sent by Symfony']
$headers
private
mixed
$headers
$html
private
resource|string|null
$html
$htmlCharset
private
string|null
$htmlCharset
= null
$htmlTemplate
private
string|null
$htmlTemplate
= null
$message
private
mixed
$message
$text
private
resource|string|null
$text
$textCharset
private
string|null
$textCharset
= null
$textTemplate
private
string|null
$textTemplate
= null
$theme
private
string
$theme
= 'default'
Methods
__clone()
public
__clone() : mixed
__construct()
public
__construct([Headers $headers = null ][, AbstractPart $body = null ]) : mixed
Parameters
- $headers : Headers = null
- $body : AbstractPart = null
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
action()
public
action(string $text, string $url) : $this
Parameters
- $text : string
- $url : string
Return values
$thisaddBcc()
public
addBcc(Address|string ...$addresses) : $this
Parameters
- $addresses : Address|string
Return values
$thisaddCc()
public
addCc(Address|string ...$addresses) : $this
Parameters
- $addresses : Address|string
Return values
$thisaddFrom()
public
addFrom(Address|string ...$addresses) : $this
Parameters
- $addresses : Address|string
Return values
$thisaddReplyTo()
public
addReplyTo(Address|string ...$addresses) : $this
Parameters
- $addresses : Address|string
Return values
$thisaddTo()
public
addTo(Address|string ...$addresses) : $this
Parameters
- $addresses : Address|string
Return values
$thisasPublicEmail()
Creates a NotificationEmail instance that is appropriate to send to normal (non-admin) users.
public
static asPublicEmail([Headers $headers = null ][, AbstractPart $body = null ]) : self
Parameters
- $headers : Headers = null
- $body : AbstractPart = null
Return values
selfattach()
public
attach(resource|string $body[, string $name = null ][, string $contentType = null ]) : $this
Parameters
- $body : resource|string
- $name : string = null
- $contentType : string = null
Return values
$thisattachFromPath()
public
attachFromPath(string $path[, string $name = null ][, string $contentType = null ]) : $this
Parameters
- $path : string
- $name : string = null
- $contentType : string = null
Return values
$thisattachPart()
public
attachPart(DataPart $part) : $this
Parameters
- $part : DataPart
Return values
$thisbcc()
public
bcc(Address|string ...$addresses) : $this
Parameters
- $addresses : Address|string
Return values
$thiscc()
public
cc(Address|string ...$addresses) : $this
Parameters
- $addresses : Address|string
Return values
$thiscontent()
public
content(string $content[, bool $raw = false ]) : $this
Parameters
- $content : string
- $raw : bool = false
Return values
$thiscontext()
public
context(array<string|int, mixed> $context) : $this
Parameters
- $context : array<string|int, mixed>
Return values
$thisdate()
public
date(DateTimeInterface $dateTime) : $this
Parameters
- $dateTime : DateTimeInterface
Return values
$thisembed()
public
embed(resource|string $body[, string $name = null ][, string $contentType = null ]) : $this
Parameters
- $body : resource|string
- $name : string = null
- $contentType : string = null
Return values
$thisembedFromPath()
public
embedFromPath(string $path[, string $name = null ][, string $contentType = null ]) : $this
Parameters
- $path : string
- $name : string = null
- $contentType : string = null
Return values
$thisensureValidity()
public
ensureValidity() : mixed
Tags
exception()
public
exception(Throwable|FlattenException $exception) : $this
Parameters
- $exception : Throwable|FlattenException
Return values
$thisfrom()
public
from(Address|string ...$addresses) : $this
Parameters
- $addresses : Address|string
Return values
$thisgenerateMessageId()
public
generateMessageId() : string
Return values
stringgetAttachments()
public
getAttachments() : array<string|int, mixed>|array<string|int, DataPart>
Return values
array<string|int, mixed>|array<string|int, DataPart>getBcc()
public
getBcc() : array<string|int, Address>
Return values
array<string|int, Address>getBody()
public
getBody() : AbstractPart|null
Return values
AbstractPart|nullgetCc()
public
getCc() : array<string|int, Address>
Return values
array<string|int, Address>getContext()
public
getContext() : array<string|int, mixed>
Return values
array<string|int, mixed>getDate()
public
getDate() : DateTimeImmutable|null
Return values
DateTimeImmutable|nullgetFrom()
public
getFrom() : array<string|int, Address>
Return values
array<string|int, Address>getHeaders()
public
getHeaders() : Headers
Return values
HeadersgetHtmlBody()
public
getHtmlBody() : resource|string|null
Return values
resource|string|nullgetHtmlCharset()
public
getHtmlCharset() : string|null
Return values
string|nullgetHtmlTemplate()
public
getHtmlTemplate() : string|null
Return values
string|nullgetPreparedHeaders()
public
getPreparedHeaders() : Headers
Return values
HeadersgetPriority()
Get the priority of this message.
public
getPriority() : int
The returned value is an integer where 1 is the highest priority and 5 is the lowest.
Return values
intgetReplyTo()
public
getReplyTo() : array<string|int, Address>
Return values
array<string|int, Address>getReturnPath()
public
getReturnPath() : Address|null
Return values
Address|nullgetSender()
public
getSender() : Address|null
Return values
Address|nullgetSubject()
public
getSubject() : string|null
Return values
string|nullgetTextBody()
public
getTextBody() : resource|string|null
Return values
resource|string|nullgetTextCharset()
public
getTextCharset() : string|null
Return values
string|nullgetTextTemplate()
public
getTextTemplate() : string|null
Return values
string|nullgetTo()
public
getTo() : array<string|int, Address>
Return values
array<string|int, Address>html()
public
html(resource|string|null $body[, string $charset = 'utf-8' ]) : $this
Parameters
- $body : resource|string|null
- $charset : string = 'utf-8'
Return values
$thishtmlTemplate()
public
htmlTemplate(string|null $template) : $this
Parameters
- $template : string|null
Return values
$thisimportance()
public
importance(string $importance) : $this
Parameters
- $importance : string
Return values
$thismarkAsPublic()
public
markAsPublic() : $this
Return values
$thismarkdown()
public
markdown(string $content) : $this
Parameters
- $content : string
Return values
$thispriority()
Sets the priority of this message.
public
priority(int $priority) : $this
The value is an integer where 1 is the highest priority and 5 is the lowest.
Parameters
- $priority : int
Return values
$thisreplyTo()
public
replyTo(Address|string ...$addresses) : $this
Parameters
- $addresses : Address|string
Return values
$thisreturnPath()
public
returnPath(Address|string $address) : $this
Parameters
- $address : Address|string
Return values
$thissender()
public
sender(Address|string $address) : $this
Parameters
- $address : Address|string
Return values
$thissetBody()
public
setBody([AbstractPart $body = null ]) : $this
Parameters
- $body : AbstractPart = null
Return values
$thissetHeaders()
public
setHeaders(Headers $headers) : $this
Parameters
- $headers : Headers
Return values
$thissubject()
public
subject(string $subject) : $this
Parameters
- $subject : string
Return values
$thistext()
public
text(resource|string|null $body[, string $charset = 'utf-8' ]) : $this
Parameters
- $body : resource|string|null
- $charset : string = 'utf-8'
Return values
$thistextTemplate()
public
textTemplate(string|null $template) : $this
Parameters
- $template : string|null
Return values
$thistheme()
public
theme(string $theme) : $this
Parameters
- $theme : string
Return values
$thisto()
public
to(Address|string ...$addresses) : $this
Parameters
- $addresses : Address|string
Return values
$thistoIterable()
public
toIterable() : iterable<string|int, mixed>
Return values
iterable<string|int, mixed>toString()
public
toString() : string
Return values
stringaddListAddressHeaderBody()
private
addListAddressHeaderBody(string $name, array<string|int, mixed> $addresses) : mixed
Parameters
- $name : string
- $addresses : array<string|int, mixed>
createDataPart()
private
createDataPart(array<string|int, mixed> $attachment) : DataPart
Parameters
- $attachment : array<string|int, mixed>
Return values
DataPartdeterminePriority()
private
determinePriority(string $importance) : int
Parameters
- $importance : string
Return values
intgenerateBody()
Generates an AbstractPart based on the raw body of a message.
private
generateBody() : AbstractPart
The most "complex" part generated by this method is when there is text and HTML bodies with related images for the HTML part and some attachments:
multipart/mixed | |------------> multipart/related | | | |------------> multipart/alternative | | | | | ------------> text/plain (with content) | | | | | ------------> text/html (with content) | | | ------------> image/png (with content) | ------------> application/pdf (with content)
Return values
AbstractPartgetExceptionAsString()
private
getExceptionAsString(Throwable|FlattenException $exception) : string
Parameters
- $exception : Throwable|FlattenException
Return values
stringprepareParts()
private
prepareParts() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullsetHeaderBody()
private
setHeaderBody(string $type, string $name, mixed $body) : $this
Parameters
- $type : string
- $name : string
- $body : mixed
Return values
$thissetListAddressHeaderBody()
private
setListAddressHeaderBody(string $name, array<string|int, mixed> $addresses) : $this
Parameters
- $name : string
- $addresses : array<string|int, mixed>