Documentation

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

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
MailBuilder

renderMail()

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
string

sendMail()

Sends the Mail

public sendMail() : bool
Return values
bool

setFrom()

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
MailBuilder

setTemplateVars()

Sets the Variables for the Template

public setTemplateVars(mixed $vars) : MailBuilder
Parameters
$vars : mixed

Template Vars

Return values
MailBuilder

        
On this page

Search results