Documentation

Mail extends AbstractWriter
in package

Mail log writer class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
5.0.0

Table of Contents

Properties

$emails  : array<string|int, mixed>
Emails to which to send the log messages
$limit  : string|null
Log limit, stored as the canonical PSR-3 level string
$mailer  : Mailer|null
Mailer object
$options  : array<string|int, mixed>
Array of mail-specific options, i.e. subject, headers, etc.

Methods

__construct()  : mixed
Constructor
addEmails()  : Mail
Add emails
addOption()  : Mail
Add option
addOptions()  : Mail
Add options
getContext()  : string
Get context for log
getEmails()  : array<string|int, mixed>
Get emails
getLogLimit()  : string|null
Get log limit
getMailer()  : Mailer
Get mailer
getOptions()  : array<string|int, mixed>
Get options
hasLogLimit()  : bool
Has log limit
isWithinLogLimit()  : bool
Check if a log level is within the set log level limit
setEmails()  : Mail
Set emails
setLogLimit()  : AbstractWriter
Set log limit
setOptions()  : Mail
Set options
writeLog()  : Mail
Write to the log
sanitize()  : string
Strip CR/LF from a value before it's written into a delimited/line-based log format, to prevent an embedded newline from forging a fake extra line (or, for writers that build header-style text like Mail's Subject line, a fake extra header).

Properties

$emails

Emails to which to send the log messages

protected array<string|int, mixed> $emails = []

$limit

Log limit, stored as the canonical PSR-3 level string

protected string|null $limit = null

$mailer

Mailer object

protected Mailer|null $mailer = null

$options

Array of mail-specific options, i.e. subject, headers, etc.

protected array<string|int, mixed> $options = []

Methods

__construct()

Constructor

public __construct(Mailer $mailer, mixed $emails[, array<string|int, mixed> $options = [] ]) : mixed

Instantiate the Mail writer object

Parameters
$mailer : Mailer
$emails : mixed
$options : array<string|int, mixed> = []

addEmails()

Add emails

public addEmails(mixed $emails) : Mail
Parameters
$emails : mixed
Return values
Mail

addOption()

Add option

public addOption(mixed $option, mixed $value) : Mail
Parameters
$option : mixed
$value : mixed
Return values
Mail

addOptions()

Add options

public addOptions(array<string|int, mixed> $options) : Mail
Parameters
$options : array<string|int, mixed>
Return values
Mail

getContext()

Get context for log

public getContext([array<string|int, mixed> $context = [] ]) : string
Parameters
$context : array<string|int, mixed> = []
Return values
string

getEmails()

Get emails

public getEmails() : array<string|int, mixed>
Return values
array<string|int, mixed>

getLogLimit()

Get log limit

public getLogLimit() : string|null
Return values
string|null

getOptions()

Get options

public getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasLogLimit()

Has log limit

public hasLogLimit() : bool
Return values
bool

isWithinLogLimit()

Check if a log level is within the set log level limit

public isWithinLogLimit(string|int $level) : bool
Parameters
$level : string|int
Return values
bool

setEmails()

Set emails

public setEmails(mixed $emails) : Mail
Parameters
$emails : mixed
Return values
Mail

setLogLimit()

Set log limit

public setLogLimit(string|int $level) : AbstractWriter

Accepts either a PSR-3 level string or a legacy severity int (0-7) for backward compatibility; always normalized and stored as the canonical PSR-3 string.

Parameters
$level : string|int
Return values
AbstractWriter

setOptions()

Set options

public setOptions(array<string|int, mixed> $options) : Mail
Parameters
$options : array<string|int, mixed>
Return values
Mail

writeLog()

Write to the log

public writeLog(string $level, string $message[, array<string|int, mixed> $context = [] ]) : Mail
Parameters
$level : string
$message : string
$context : array<string|int, mixed> = []
Return values
Mail

sanitize()

Strip CR/LF from a value before it's written into a delimited/line-based log format, to prevent an embedded newline from forging a fake extra line (or, for writers that build header-style text like Mail's Subject line, a fake extra header).

protected sanitize(string $value) : string
Parameters
$value : string
Return values
string

        
On this page

Search results