Files

1.8 KiB

Email Workers Patterns

Fetch the workflow page, then adapt it to the application's routing and storage requirements.

Task Documentation
Route by recipient or subject, forward to multiple destinations, or reject Email handler actions
Parse MIME bodies and attachments Email handler parsing guidance
Filter incoming mail Spam filtering
Reply within the incoming event with threading Reply requirements and examples
Archive metadata in KV or enqueue mail for later processing Email storage and processing
Store raw mail or extracted attachment bytes in R2 R2 Workers API
Notify a webhook or schedule work within the invocation lifetime Fetch and execution context
Send a later response or new outbound attachment Sending Workers API and attachment examples

Plan a single read of raw content when both parsing and storage need it. A queue consumer or later request sends through the outbound API because the original incoming email event is no longer available.