Phpxforms documentation

Mailer
in package

Simple Email templating. Uses the phpmailer for sending

Tags
author

DaVee

version
0.87dev
license

Lesser General Public License 2.1 or later; see http://www.gnu.org/licenses/lgpl-2.1.html

Table of Contents

Constants

CONTENT_MARK  = 'contentMail'
CONTENT_SUBJECT  = 'contentSubject'

Properties

$setFrom  : bool
$body  : string|null
$db  : SQL
$log  : Logger|null
$mailer  : PHPMailer
$template  : array<string, string>|null

Methods

__construct()  : mixed
addAttachment()  : void
Add message attachment
addStringAttachment()  : void
Add attachment in base64 format
exist()  : bool
Checks if the template is loaded and possibility to send mail
getEml()  : string
getHtml()  : string
Fill template with data
getParam()  : string|null
Returns template parameter
loadTemplate()  : bool
Load template
replace()  : string
Insert variables into template
reset()  : void
Reset phpmailer content
send()  : bool|null
Send email template with inserted data
setBody()  : void
Set message text
setBodyFile()  : void
Set message text from file
anonymize()  : string
Remove parts of email address to be GDPR compliant for log
anonymizeHide()  : string
Replace inside part of string
createMailer()  : bool
Initialize phpmailer

Constants

CONTENT_MARK

public string CONTENT_MARK = 'contentMail'

CONTENT_SUBJECT

public string CONTENT_SUBJECT = 'contentSubject'

Properties

$setFrom

public static bool $setFrom = true

Disable adding second envelope sender because sendmail_path property already contains a -f parameter

$body

protected string|null $body = null

$mailer

protected PHPMailer $mailer = null

$template

protected array<string, string>|null $template = null

Methods

__construct()

public __construct(SQL $db[, string|null $type = null ][, int|null $langId = null ][, Logger|null $log = null ]) : mixed
Parameters
$db : SQL
$type : string|null = null
$langId : int|null = null
$log : Logger|null = null

addAttachment()

Add message attachment

public addAttachment(array<string|int, string>|string $attachments[, string $name = '' ]) : void
Parameters
$attachments : array<string|int, string>|string
$name : string = ''
Tags
throws
RuntimeException|phpmailerException

addStringAttachment()

Add attachment in base64 format

public addStringAttachment(string $fileName, binary $data[, string $mime = '' ]) : void
Parameters
$fileName : string
$data : binary
$mime : string = ''
Tags
throws
RuntimeException

exist()

Checks if the template is loaded and possibility to send mail

public exist() : bool
Return values
bool

getEml()

public getEml() : string
Tags
throws
phpmailerException
Return values
string

getHtml()

Fill template with data

public getHtml([array<string, string> $data = [] ]) : string
Parameters
$data : array<string, string> = []
Return values
string

getParam()

Returns template parameter

public getParam(string $param) : string|null
Parameters
$param : string
Return values
string|null

loadTemplate()

Load template

public loadTemplate(string $type[, int|null $langId = null ][, bool $onlyAcive = true ]) : bool
Parameters
$type : string
$langId : int|null = null
$onlyAcive : bool = true
Return values
bool

replace()

Insert variables into template

public replace(string $template, array<string, string> $data) : string
Parameters
$template : string
$data : array<string, string>
Return values
string

reset()

Reset phpmailer content

public reset() : void

send()

Send email template with inserted data

public send([array<string, string> $data = [] ][, mixed $emails = [] ][, bool $mailAll = true ][, int $userId = 0 ]) : bool|null
Parameters
$data : array<string, string> = []
$emails : mixed = []
$mailAll : bool = true
$userId : int = 0
Tags
throws
phpmailerException
Return values
bool|null

setBody()

Set message text

public setBody(string $text) : void
Parameters
$text : string

setBodyFile()

Set message text from file

public setBodyFile(string $fileName) : void
Parameters
$fileName : string
Tags
throws
RuntimeException

anonymize()

Remove parts of email address to be GDPR compliant for log

protected anonymize(array<string|int, string> $mails) : string
Parameters
$mails : array<string|int, string>
Return values
string

anonymizeHide()

Replace inside part of string

protected anonymizeHide(string $string[, int $chars = 2 ][, string $new = '*' ]) : string
Parameters
$string : string
$chars : int = 2
$new : string = '*'
Return values
string

createMailer()

Initialize phpmailer

protected createMailer() : bool
Return values
bool

        
On this page

Search results