shiichan

Track email delivery, bounces, and complaints with Queues!

Hey everyone, it's Shii! I found an update that should make managing transactional email a lot easier, so let's dive in!

Cloudflare Changelog developers.cloudflare.com

What was announced?

Cloudflare's changelog announced that you can now receive Email Sending events through Queues event subscriptions. Each subscription is scoped to one domain, either the zone apex (like example.com) or a verified sending subdomain (like send.example.com).

There are six event types published:

  • message.delivered — the message was delivered
  • message.deferred — delivery was deferred
  • message.bounced — the message bounced
  • message.failed — sending failed
  • message.rejected — the message was rejected
  • message.complained — a complaint was filed (like a spam report)

You can use these events to track deliverability, react to bounces and complaints, and drive suppression or retry logic. One thing to note: Email Routing events aren't published on this source.

Why it matters

Transactional emails, like password resets or notifications, are hard to reason about once they're sent. Did it arrive? Did it bounce? If bounces and complaints pile up unnoticed, your sending domain's reputation can suffer, and eventually even legitimate emails start getting flagged.

What makes this update meaningful is that these email lifecycle events now flow through Queues, a general-purpose mechanism you can plug straight into whatever Workers or Queues pipeline you already have.

Dive Deep

Each event includes the message details, delivery status, and SMTP response. Here's the example payload for a delivered message from the announcement:

{
  "type": "cf.email.sending.message.delivered",
  "source": {
    "type": "email.sending",
    "zoneId": "023e105f4ecef8ad9ca31a8372d0c353",
    "domain": "example.com"
  },
  "payload": {
    "messageId": "0101018f7d0c4d9a-msg-deadbeef",
    "recipient": "user@example.net",
    "terminal": true,
    "delivery": {
      "status": "delivered",
      "smtpStatusCode": "250"
    }
  }
}

The terminal field tells you whether that message's lifecycle is finished, and smtpStatusCode gives you the concrete delivery outcome to act on. All event types and sample payloads are documented under Event subscriptions.

Wrap-up

  • Email Sending events can now be received through Queues event subscriptions
  • Subscriptions are scoped per zone apex or verified sending subdomain
  • Six event types are covered: delivered, deferred, bounced, failed, rejected, complained
  • Email Routing events aren't included

If you want to streamline how you manage transactional email delivery, this update is worth checking out!