Documentation

Mail extends PHPMailer

Wrapper class for \PHPMailer\PHPMailer\PHPMailer

Tags
copyright

Cloudrexx AG

author

Project Team SS4U info@cloudrexx.com

author

Thomas Wirz thomas.wirz@cloudrexx.com

subpackage

core_mailtemplate

Table of Contents

Properties

$clientIp  : string
IP of this request (as initialized by {@see static::initClientIp()}).
$ignoreSenderValidation  : bool
Whether the sender domain (from {@see static::$From}) needs to be verified at all
$requiresFullSenderAuthentication  : bool
Whether the sender domain (from {@see static::$From}) needs to be verified by both, SPF and DKIM and also be in alignement with DMARC.
$selectedSmtpServerId  : int
ID of the SMTP server ({@see \SmtpSettings::getSmtpAccounts()}) selected for sending e-mails.
$softFail  : bool
If set to TRUE, then the send process is not actually executed.

Methods

__construct()  : mixed
addAttachment()  : mixed
addEmbeddedImage()  : mixed
getSmtpName()  : string
Get the name (label) of the currently selected SMTP server used for sending e-mails.
ignoreSenderValidation()  : void
Sets if sender authentication is required.
postSend()  : mixed
preSend()  : mixed
requiresFullSenderAuthentication()  : void
Sets if full sender authentication is required.
selectSmtpAccount()  : void
Select the SMTP server ({@see \SmtpSettings::getSmtpAccounts()}) to use for sending e-mails.
softFail()  : mixed
Enable {@see static::$softFail}
addAnAddress()  : mixed
getDkimKey()  : array<string|int, mixed>
Get the current active DKIM key and selector to use for signing
initClientIp()  : void
Determine the IP (using {@see \Cx\Core\Routing\Model\Entity\Request::getClientIp()}) of this request and cache it in {@see static::$clientIp}.
isAllowedAttachment()  : bool
Verify if $path is a valid attachment
makeImagesAbsoluteInHtmlBody()  : mixed
Converts `src` attributes of `img` HTML tags in the HTML-body {@see static::$Body} into absolute URLs.
parseEsiFunctions()  : void
Parse esi functions in body
parseNodePlaceholders()  : void
Replaces any {@see \Cx\Core\Routing\NodePlaceholder} by its target URL in the HTML-body ({@see static::Body}).
requiresDkimSigning()  : bool
Check if DKIM signing is required for this instance.
signWithDkim()  : void
Signs the mail with DKIM in case DKIM has been set up for the domain of {@see static::$From}.
verifySender()  : bool
Verify if the domain used by {@see static::From} and {@see static::Sender} is properly been authenticated

Properties

$clientIp

IP of this request (as initialized by {@see static::initClientIp()}).

protected string $clientIp = ''

Will be used for logging.

$ignoreSenderValidation

Whether the sender domain (from {@see static::$From}) needs to be verified at all

protected bool $ignoreSenderValidation = false

$requiresFullSenderAuthentication

Whether the sender domain (from {@see static::$From}) needs to be verified by both, SPF and DKIM and also be in alignement with DMARC.

protected bool $requiresFullSenderAuthentication = false

$selectedSmtpServerId

ID of the SMTP server ({@see \SmtpSettings::getSmtpAccounts()}) selected for sending e-mails.

protected int $selectedSmtpServerId = 0

$softFail

If set to TRUE, then the send process is not actually executed.

protected bool $softFail = false

However the method static::send() still returns TRUE as if the send process was successful.

Methods

__construct()

public __construct([mixed $exceptions = null ]) : mixed
Parameters
$exceptions : mixed = null

addAttachment()

public addAttachment(mixed $path[, mixed $name = '' ][, mixed $encoding = self::ENCODING_BASE64 ][, mixed $type = '' ][, mixed $disposition = 'attachment' ]) : mixed
Parameters
$path : mixed
$name : mixed = ''
$encoding : mixed = self::ENCODING_BASE64
$type : mixed = ''
$disposition : mixed = 'attachment'

addEmbeddedImage()

public addEmbeddedImage(mixed $path, mixed $cid[, mixed $name = '' ][, mixed $encoding = self::ENCODING_BASE64 ][, mixed $type = '' ][, mixed $disposition = 'inline' ]) : mixed
Parameters
$path : mixed
$cid : mixed
$name : mixed = ''
$encoding : mixed = self::ENCODING_BASE64
$type : mixed = ''
$disposition : mixed = 'inline'

getSmtpName()

Get the name (label) of the currently selected SMTP server used for sending e-mails.

public getSmtpName() : string
Return values
string

Name of selected SMTP server

ignoreSenderValidation()

Sets if sender authentication is required.

public ignoreSenderValidation([bool $ignore = true ]) : void

Sender authentication implies that the sender domain (from static:$From) must be verified by SPF or DKIM. If $ignore is set to false, then no sender validation is performed. WARNING: Setting $ignore to true is highly discouraged!

Parameters
$ignore : bool = true

Set to true to ignore sender authentication. This will also set static::$requiresFullSenderAuthentication to false.

postSend()

public postSend() : mixed
Tags
inheritDoc

preSend()

public preSend() : mixed
Tags
inheritDoc

requiresFullSenderAuthentication()

Sets if full sender authentication is required.

public requiresFullSenderAuthentication([bool $requires = true ]) : void

Full sender authentication implies that the sender domain (from static:$From) must be verified by SPF, DKIM and in alignement with DMARC. If $requires set to false, then only one of SPF or DKIM must be verified and DMARC alignmement is not required.

Parameters
$requires : bool = true

Set to true to require full sender authentication

selectSmtpAccount()

Select the SMTP server ({@see \SmtpSettings::getSmtpAccounts()}) to use for sending e-mails.

public selectSmtpAccount(int $id) : void
Parameters
$id : int

ID of SMTP server

Tags
throws
Exception

If selection failed.

softFail()

Enable {@see static::$softFail}

public softFail() : mixed

addAnAddress()

protected addAnAddress(mixed $kind, mixed $address[, mixed $name = '' ]) : mixed
Parameters
$kind : mixed
$address : mixed
$name : mixed = ''
Tags
inheritDoc

getDkimKey()

Get the current active DKIM key and selector to use for signing

protected getDkimKey() : array<string|int, mixed>
Tags
throws
Exception

In case no active DKIM key can be loaded

Return values
array<string|int, mixed>

Array with two keys, 'selector' and 'key'.

initClientIp()

Determine the IP (using {@see \Cx\Core\Routing\Model\Entity\Request::getClientIp()}) of this request and cache it in {@see static::$clientIp}.

protected initClientIp() : void

If request is a CLI-call, then static::$clientIp will be set to 'cli'. If the request was made using an invalid IP (see Request::getClientIp()), then static::$clientIp will be set to 'unknown'.

isAllowedAttachment()

Verify if $path is a valid attachment

protected isAllowedAttachment(mixed $path) : bool

A valid attachment is a file located in a non-privileged filesystem location. See FileSystemFile::$privileged.

Parameters
$path : mixed
Return values
bool

True if $path is a file located in one of the allowed locations.

makeImagesAbsoluteInHtmlBody()

Converts `src` attributes of `img` HTML tags in the HTML-body {@see static::$Body} into absolute URLs.

protected makeImagesAbsoluteInHtmlBody() : mixed

parseEsiFunctions()

Parse esi functions in body

protected parseEsiFunctions() : void

parseNodePlaceholders()

Replaces any {@see \Cx\Core\Routing\NodePlaceholder} by its target URL in the HTML-body ({@see static::Body}).

protected parseNodePlaceholders() : void

requiresDkimSigning()

Check if DKIM signing is required for this instance.

protected requiresDkimSigning() : bool
Return values
bool

true if DKIM signing is required.

signWithDkim()

Signs the mail with DKIM in case DKIM has been set up for the domain of {@see static::$From}.

protected signWithDkim() : void
Tags
throws
Exception

In case DKIM signing fails.

verifySender()

Verify if the domain used by {@see static::From} and {@see static::Sender} is properly been authenticated

protected verifySender() : bool
Return values
bool

Returns true if sender domain is authenticated. Otherwise false.


        
On this page

Search results