Skip to content

LoggerMail

Defines a mail backend that captures sent messages to the logger.

To enable, save a variable in settings.php (or otherwise) whose value can be as simple as:


  • Full name: \Drupal\helper\Plugin\Mail\LoggerMail
  • This class implements: MailInterface, ContainerFactoryPluginInterface

Properties

logger

The logger.

protected \Psr\Log\LoggerInterface $logger

Methods

__construct

Constructs a new LoggerMail object.

public __construct(array $configuration, string $plugin_id, mixed $plugin_definition, \Psr\Log\LoggerInterface $logger): mixed

Parameters:

Parameter Type Description
$configuration array
A configuration array containing information about the plugin instance.
$plugin_id string
The plugin_id for the plugin instance.
$plugin_definition mixed
The plugin implementation definition.
$logger \Psr\Log\LoggerInterface
The logger.

create

{@inheritdoc}

public static create(\Symfony\Component\DependencyInjection\ContainerInterface $container, array $configuration, mixed $plugin_id, mixed $plugin_definition): mixed
  • This method is static. Parameters:
Parameter Type Description
$container \Symfony\Component\DependencyInjection\ContainerInterface
$configuration array
$plugin_id mixed
$plugin_definition mixed

mail

{@inheritdoc}

public mail(array $message): mixed

Parameters:

Parameter Type Description
$message array

format

{@inheritdoc}

public format(array $message): mixed

Parameters:

Parameter Type Description
$message array

formatMessage

Formats the mail message for display.

protected formatMessage(array $message): string

Parameters:

Parameter Type Description
$message array
The mail message.

Return Value:

The mail output.