You are here

public function SpoolStorage::addMail in Simplenews 8.2

Same name and namespace in other branches
  1. 8 src/Spool/SpoolStorage.php \Drupal\simplenews\Spool\SpoolStorage::addMail()
  2. 3.x src/Spool/SpoolStorage.php \Drupal\simplenews\Spool\SpoolStorage::addMail()

Save mail message in mail cache table.

Parameters

array $spool: The message to be stored in the spool table, as an array containing the following keys:

Overrides SpoolStorageInterface::addMail

File

src/Spool/SpoolStorage.php, line 287

Class

SpoolStorage
Default database spool storage.

Namespace

Drupal\simplenews\Spool

Code

public function addMail(array $spool) {
  if (!isset($spool['status'])) {
    $spool['status'] = SpoolStorageInterface::STATUS_PENDING;
  }
  if (!isset($spool['timestamp'])) {
    $spool['timestamp'] = REQUEST_TIME;
  }
  if (isset($spool['data'])) {
    $spool['data'] = serialize($spool['data']);
  }
  $this->connection
    ->insert('simplenews_mail_spool')
    ->fields($spool)
    ->execute();
}