You are here

public static function MailSafetyController::insert in Mail Safety 8

Saves the mail to the dashboard.

Parameters

array $message: The drupal message array.

1 call to MailSafetyController::insert()
mail_safety_mail_alter in ./mail_safety.module
Implements hook_mail_alter().

File

src/Controller/MailSafetyController.php, line 116

Class

MailSafetyController
Class MailSafetyController.

Namespace

Drupal\mail_safety\Controller

Code

public static function insert(array $message) {

  // Let other modules alter the message array before a mail is inserted.
  // E.g. save attachments that are sent with the mail.
  \Drupal::moduleHandler()
    ->alter('mail_safety_pre_insert', $message);
  $mail = [
    'sent' => time(),
    'mail' => serialize($message),
  ];
  $connection = \Drupal::database();
  $connection
    ->insert('mail_safety_dashboard')
    ->fields($mail)
    ->execute();
}