Email
extends BaseContent
in package
Implement email object
This class provides general interfaces to trigger email object specific reactions. The emails are contents in administration context, this class provides additional handler to send and register mails.
Tags
Table of Contents
- $dbal : MailDBAL|null
- The database abstraction layer buffer
- $alternative_body : string|null
- The text email body
- $body : string|null
- The email body
- $template : Template|null
- __construct() : mixed
- Email constructor
- Attachments() : array<string|int, mixed>|null
- Get list of all attachments including static and dynamic
- CarbonCopyReceivers() : array<string|int, mixed>
- Get cc receivers
- Content() : string|object
- Get the request payload Get the request property and parse it on demand
- Copy() : Result
- Copy instance Create a clone of this email and resets the sent status
- Delete() : Result
- delete a whole asset as an asset is an extended form of the generic content the whole folder has to be deleted
- FlushToDatabase() : Result
- Store the email in database for sending
- FormatDate() : string
- Format the date
- GetPath() : string|null
- MoveStatics() : Result
- Move statics
- Preview() : Result
- Build a preview of the email and return as rendered content
- Receiver() : array<string|int, mixed>
- Get receiver as array
- RenderTemplate() : Result
- Render the email base template and on demand the secondary one
- RequestObject() : object
- Get the request as object
- RootPath() : string
- expose root path provide an interface to the date storage path of this asset
- Save() : Result
- save object entry in file system and git repository store the current payload inside the system storage and commit the changes to the local repository
- Send() : Result
- Deliver email to receiver.
- Template() : Template|null
- Get the template instance
- database() : MailDBAL|null
- Get the database instance
- mapImages() : void
- map includes parse object image and link tags
Properties
$dbal
The database abstraction layer buffer
protected
MailDBAL|null
$dbal
= null
$alternative_body
The text email body
private
string|null
$alternative_body
= null
$body
The email body
private
string|null
$body
= null
$template
private
Template|null
$template
= null
Methods
__construct()
Email constructor
public
__construct([string|int $id = null ][, string $language = null ]) : mixed
Create new instance of email object
Parameters
- $id : string|int = null
-
The Object id
- $language : string = null
-
The local language
Return values
mixed —Attachments()
Get list of all attachments including static and dynamic
public
Attachments() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —CarbonCopyReceivers()
Get cc receivers
public
CarbonCopyReceivers() : array<string|int, mixed>
Parse the local storage data and return the list of registered cc receivers.
Return values
array<string|int, mixed> —List of registered receivers
Content()
Get the request payload Get the request property and parse it on demand
public
Content([bool $parse = true ]) : string|object
Parameters
- $parse : bool = true
Return values
string|object —Copy()
Copy instance Create a clone of this email and resets the sent status
public
Copy([null $target = null ]) : Result
Parameters
- $target : null = null
-
Required for compatibility
Return values
Result —A system result object
Delete()
delete a whole asset as an asset is an extended form of the generic content the whole folder has to be deleted
public
Delete([bool $skip = false ]) : Result
Parameters
- $skip : bool = false
-
Skip hooks on demand
Return values
Result —A system result object
FlushToDatabase()
Store the email in database for sending
public
FlushToDatabase() : Result
Return values
Result —FormatDate()
Format the date
public
FormatDate(mixed $time[, string|null $format = 'd.m.Y' ]) : string
Parameters
- $time : mixed
-
The time, can be an unix timestamp or, an object or even a parseable string
- $format : string|null = 'd.m.Y'
-
Output format
Return values
string —GetPath()
public
GetPath() : string|null
Tags
Return values
string|null —MoveStatics()
Move statics
public
MoveStatics() : Result
Move the static includes to local storage
Return values
Result —A system result object
Preview()
Build a preview of the email and return as rendered content
public
Preview([string $type = 'html' ]) : Result
Parameters
- $type : string = 'html'
-
The template type to use. Defaults to html
Return values
Result —A system result object
Receiver()
Get receiver as array
public
Receiver() : array<string|int, mixed>
Return values
array<string|int, mixed> —RenderTemplate()
Render the email base template and on demand the secondary one
public
RenderTemplate(MailSender|null $interface) : Result
Will also resolve static includes and dynamic attachments When attachments are encrypted the passwords will be added to the token %filepasswords%
Parameters
- $interface : MailSender|null
-
The MailSender
Return values
Result —A system result object with body in values and text body in secondary values
RequestObject()
Get the request as object
public
RequestObject() : object
Return values
object —RootPath()
expose root path provide an interface to the date storage path of this asset
public
RootPath() : string
Return values
string —the absolute path to the storage folder
Save()
save object entry in file system and git repository store the current payload inside the system storage and commit the changes to the local repository
public
Save([bool $force_new_id = false ][, bool $skip = false ]) : Result
Parameters
- $force_new_id : bool = false
-
Indicate force new id on demand (local id empty)
- $skip : bool = false
-
Skips sending email on demand
Return values
Result —A default system result set
Send()
Deliver email to receiver.
public
Send() : Result
Calls the hook on success, otherwise it will log the mail as failed
Return values
Result —Template()
Get the template instance
public
Template() : Template|null
This method is cached
Return values
Template|null —database()
Get the database instance
private
database() : MailDBAL|null
Return values
MailDBAL|null —mapImages()
map includes parse object image and link tags
private
mapImages(MailSender|null $mail_interface) : void
Parameters
- $mail_interface : MailSender|null
-
Reference to the send mail interface, used to embed the images