Last updated: August 28, 2026.
A queue makes requests faster and protects delivery from short provider outages. Store the message intent, let a worker claim it, and distinguish temporary failures from permanent ones.
Calculate bounded backoff
<?php
function nextEmailAttempt(int $attempt): DateTimeImmutable
{
$seconds = min(3600, 30 * (2 ** min($attempt, 7)));
return (new DateTimeImmutable())->modify('+' . ($seconds + random_int(0, 15)) . ' seconds');
}Prevent duplicate sends
- Claim queue rows transactionally.
- Give each logical message a unique key.
- Do not retry invalid recipients indefinitely.
- Store provider message IDs for webhooks.
- Apply a retention policy to message data.
Adding automated email to a data-driven application?
PHPRunner supports event-driven email and generated application workflows. Explore PHPRunner.
Reference: PHP DateTimeImmutable reference.