public function SpoolList::setLastMailResult in Simplenews 3.x
Same name and namespace in other branches
- 8.2 src/Spool/SpoolList.php \Drupal\simplenews\Spool\SpoolList::setLastMailResult()
Records the result of sending the last mail.
Parameters
int $result: One of the SpoolStorageInterface::STATUS_* constants.
Overrides SpoolListInterface::setLastMailResult
1 call to SpoolList::setLastMailResult()
- SpoolList::nextMail in src/
Spool/ SpoolList.php - Returns a Simplenews mail to be sent.
File
- src/
Spool/ SpoolList.php, line 121
Class
- SpoolList
- List of mail spool entries.
Namespace
Drupal\simplenews\SpoolCode
public function setLastMailResult($result) {
$spool_data = current($this->spoolRows);
$spool_data->result = $result;
if ($result == SpoolStorageInterface::STATUS_PENDING) {
$this->pendingErrors[] = $spool_data->msid;
$this->consecutivePendingErrors++;
if ($this->consecutivePendingErrors > static::MAX_ERRORS) {
throw new AbortSendingException('Maximum error limit exceeded');
}
}
// Update the spool entry. We can't batch this part up as that would lead
// to duplicate emails in case of PHP execution time overrun.
$this->spoolStorage
->updateMails([
$spool_data->msid,
], $result);
if ($result == SpoolStorageInterface::STATUS_DONE) {
// We have successfully sent a mail so there is not a global transport
// error. Reset the count of consecutive errors.
$this->consecutivePendingErrors = 0;
$this->success = TRUE;
}
next($this->spoolRows);
}