You are here

protected function DigestManager::deliverDigest in Message Digest 8

Send the actual digest email.

Parameters

\Drupal\user\UserInterface $account: Account to deliver the message to.

string $entity_type: The entity type. Leave empty for global digests.

string|int $entity_id: The entity ID. Leave empty for global digests.

\Drupal\message_digest\Plugin\Notifier\DigestInterface $notifier: The digest notifier plugin ID used for this digest.

string $formatted_message: The formatted message.

1 call to DigestManager::deliverDigest()
DigestManager::processSingleUserDigest in src/DigestManager.php
Processes and sends an individual digest for a given user.

File

src/DigestManager.php, line 138

Class

DigestManager
Digest manager service.

Namespace

Drupal\message_digest

Code

protected function deliverDigest(UserInterface $account, $entity_type, $entity_id, DigestInterface $notifier, $formatted_message) {
  $params = [
    'body' => $formatted_message,
    'entity_type' => $entity_type,
    'entity_id' => $entity_id,
    'notifier' => $notifier,
  ];

  // @todo Use the message_notify sender service.
  // @see https://www.drupal.org/node/2103013
  $this->mailManager
    ->mail('message_digest', 'digest', $account
    ->getEmail(), $account
    ->language(), $params);
}