MailBuilder
in package
Class for building Mails
Table of Contents
Properties
- $attachments : null|array<string|int, mixed>
- A KeyValue Array for all Attachments, the key defines the Name - the value contains the path
- $from : null|string
- The sender Mail Address - set null to use default
- $fromName : null|string
- The sender Name - set null to use default
- $mailTemplate : string
- Name of the Mail Template (should be twig)
- $mailVars : null|array<string|int, mixed>
- Sets the vars to use for rendering the template
- $recipients : null|array<string|int, mixed>
- All Recipients for the Mail
- $subject : string
- Mail Subject
Methods
- addAttachment() : MailBuilder
- Adds an attachment to the email
- addRecipient() : MailBuilder
- Adds a Recipient
- renderMail() : string
- Renders a Mail to html
- sendMail() : bool
- Sends the Mail
- setFrom() : MailBuilder
- Sets the Mail sender and sender name
- setSubject() : MailBuilder
- Sets the Subject of the Mail
- setTemplate() : MailBuilder
- Sets the Template
- setTemplateVars() : MailBuilder
- Sets the Variables for the Template
Properties
$attachments
A KeyValue Array for all Attachments, the key defines the Name - the value contains the path
public
null|array<string|int, mixed>
$attachments
= \null
$from
The sender Mail Address - set null to use default
public
null|string
$from
$fromName
The sender Name - set null to use default
public
null|string
$fromName
$mailTemplate
Name of the Mail Template (should be twig)
public
string
$mailTemplate
$mailVars
Sets the vars to use for rendering the template
public
null|array<string|int, mixed>
$mailVars
$recipients
All Recipients for the Mail
public
null|array<string|int, mixed>
$recipients
$subject
Mail Subject
public
string
$subject
Methods
addAttachment()
Adds an attachment to the email
public
addAttachment(string $name, string $fileName) : MailBuilder
Parameters
- $name : string
-
Display Name of the Attachment
- $fileName : string
-
Path to the File
Return values
MailBuilderaddRecipient()
Adds a Recipient
public
addRecipient(string $mailAddress) : MailBuilder
Parameters
- $mailAddress : string
Return values
MailBuilderrenderMail()
Renders a Mail to html
public
renderMail([null|ITheme $theme = null ]) : string
Parameters
- $theme : null|ITheme = null
-
(optional) Theme to use, null for default
Return values
stringsendMail()
Sends the Mail
public
sendMail() : bool
Return values
boolsetFrom()
Sets the Mail sender and sender name
public
setFrom(string $from, string $fromName) : MailBuilder
Parameters
- $from : string
-
Mail Address of the sender
- $fromName : string
-
Name of the sender
Return values
MailBuildersetSubject()
Sets the Subject of the Mail
public
setSubject(string $subject) : MailBuilder
Parameters
- $subject : string
Return values
MailBuildersetTemplate()
Sets the Template
public
setTemplate(mixed $template) : MailBuilder
Parameters
- $template : mixed
Return values
MailBuildersetTemplateVars()
Sets the Variables for the Template
public
setTemplateVars(mixed $vars) : MailBuilder
Parameters
- $vars : mixed
-
Template Vars