SwiftMailerHandler
extends MailHandler
in package
SwiftMailerHandler uses Swift_Mailer to send the emails
Since Monolog 2.6. Use SymfonyMailerHandler instead.
Tags
Table of Contents
Properties
- $bubble : bool
- $formatter : FormatterInterface|null
- $level : int
- $mailer : Swift_Mailer
- $processors : array<string|int, callable>
- $messageTemplate : Swift_Message|callable(string, array<string|int, Record>): Swift_Message
Methods
- __construct() : mixed
- __destruct() : mixed
- __sleep() : mixed
- close() : void
- Closes the handler.
- getBubble() : bool
- Gets the bubbling behavior.
- getFormatter() : FormatterInterface
- {@inheritDoc}
- getLevel() : int
- Gets minimum logging level at which this handler will be triggered.
- handle() : bool
- Handles a record.
- handleBatch() : void
- Handles a set of records at once.
- isHandling() : bool
- Checks whether the given record will be handled by this handler.
- popProcessor() : callable
- {@inheritDoc}
- pushProcessor() : HandlerInterface
- {@inheritDoc}
- reset() : void
- setBubble() : self
- Sets the bubbling behavior.
- setFormatter() : HandlerInterface
- {@inheritDoc}
- setLevel() : self
- Sets minimum logging level at which this handler will be triggered.
- buildMessage() : Swift_Message
- Creates instance of Swift_Message to be sent
- getDefaultFormatter() : FormatterInterface
- Gets the default formatter.
- getHighestRecord() : array<string|int, mixed>
- getSubjectFormatter() : FormatterInterface
- Gets the formatter for the Swift_Message subject.
- isHtmlBody() : bool
- processRecord() : array<string|int, mixed>
- Processes a record.
- resetProcessors() : void
- send() : void
- Send a mail with the given content
- write() : void
- Writes the record down to the log of the implementing handler
Properties
$bubble
protected
bool
$bubble
= true
$formatter
protected
FormatterInterface|null
$formatter
$level
protected
int
$level
= \Monolog\Logger::DEBUG
Tags
$mailer
protected
Swift_Mailer
$mailer
$processors
protected
array<string|int, callable>
$processors
= []
Tags
$messageTemplate
private
Swift_Message|callable(string, array<string|int, Record>): Swift_Message
$messageTemplate
Methods
__construct()
public
__construct(Swift_Mailer $mailer, callable|Swift_Message $message[, mixed $level = Logger::ERROR ][, bool $bubble = true ]) : mixed
Parameters
- $mailer : Swift_Mailer
-
The mailer to use
- $message : callable|Swift_Message
-
An example message for real messages, only the body will be replaced
- $level : mixed = Logger::ERROR
-
The minimum logging level at which this handler will be triggered
- $bubble : bool = true
-
Whether the messages that are handled can bubble up the stack or not
Tags
__destruct()
public
__destruct() : mixed
__sleep()
public
__sleep() : mixed
close()
Closes the handler.
public
close() : void
getBubble()
Gets the bubbling behavior.
public
getBubble() : bool
Return values
bool —true means that this handler allows bubbling. false means that bubbling is not permitted.
getFormatter()
{@inheritDoc}
public
getFormatter() : FormatterInterface
Return values
FormatterInterfacegetLevel()
Gets minimum logging level at which this handler will be triggered.
public
getLevel() : int
Tags
Return values
inthandle()
Handles a record.
public
handle(array<string|int, mixed> $record) : bool
Parameters
- $record : array<string|int, mixed>
-
The record to handle
Return values
bool —true means that this handler handled the record, and that bubbling is not permitted. false means the record was either not processed or that this handler allows bubbling.
handleBatch()
Handles a set of records at once.
public
handleBatch(array<string|int, mixed> $records) : void
Parameters
- $records : array<string|int, mixed>
-
The records to handle (an array of record arrays)
isHandling()
Checks whether the given record will be handled by this handler.
public
isHandling(array<string|int, mixed> $record) : bool
Parameters
- $record : array<string|int, mixed>
-
Partial log record containing only a level key
Return values
boolpopProcessor()
{@inheritDoc}
public
popProcessor() : callable
Return values
callablepushProcessor()
{@inheritDoc}
public
pushProcessor(callable $callback) : HandlerInterface
Parameters
- $callback : callable
Return values
HandlerInterfacereset()
public
reset() : void
setBubble()
Sets the bubbling behavior.
public
setBubble(bool $bubble) : self
Parameters
- $bubble : bool
-
true means that this handler allows bubbling. false means that bubbling is not permitted.
Return values
selfsetFormatter()
{@inheritDoc}
public
setFormatter(FormatterInterface $formatter) : HandlerInterface
Parameters
- $formatter : FormatterInterface
Return values
HandlerInterfacesetLevel()
Sets minimum logging level at which this handler will be triggered.
public
setLevel(Level|LevelName|LogLevel::* $level) : self
Parameters
- $level : Level|LevelName|LogLevel::*
-
Level or level name
Return values
selfbuildMessage()
Creates instance of Swift_Message to be sent
protected
buildMessage(string $content, array<string|int, mixed> $records) : Swift_Message
Parameters
- $content : string
-
formatted email body to be sent
- $records : array<string|int, mixed>
-
Log records that formed the content
Tags
Return values
Swift_MessagegetDefaultFormatter()
Gets the default formatter.
protected
getDefaultFormatter() : FormatterInterface
Return values
FormatterInterfacegetHighestRecord()
protected
getHighestRecord(array<string|int, mixed> $records) : array<string|int, mixed>
Parameters
- $records : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getSubjectFormatter()
Gets the formatter for the Swift_Message subject.
protected
getSubjectFormatter(string|null $format) : FormatterInterface
Parameters
- $format : string|null
-
The format of the subject
Return values
FormatterInterfaceisHtmlBody()
protected
isHtmlBody(string $body) : bool
Parameters
- $body : string
Return values
boolprocessRecord()
Processes a record.
protected
processRecord(array<string|int, mixed> $record) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>resetProcessors()
protected
resetProcessors() : void
send()
Send a mail with the given content
protected
send(string $content, array<string|int, mixed> $records) : void
Parameters
- $content : string
-
formatted email body to be sent
- $records : array<string|int, mixed>
-
the array of log records that formed this content
write()
Writes the record down to the log of the implementing handler
protected
write(array<string|int, mixed> $record) : void
Parameters
- $record : array<string|int, mixed>