Loading components
Send and receive email in Convex via Resend or Amazon SES with parsed inbound mail, threading, suppression, and delivery tracking in one component.
npm install @sayedhfatimi/convex-emailconvex-email adds full-duplex email to a Convex backend through a single `Email` client class. Inbound messages from Resend or Amazon SES are parsed, deduplicated, SPF/DKIM/DMARC-verified, threaded by In-Reply-To, and stored in Convex file storage with an `onInbound` mutation hook. Outbound mail is queued in an outbox with background retries, suppression tracking for hard bounces and complaints, RFC 8058 one-click unsubscribe headers, and delivery event callbacks.
The @sayedhfatimi/convex-email component exposes an onInbound hook that receives each parsed, verified, and de-duplicated message as a normalized object in a Convex mutation. It supports Resend receiving, AWS SES receipt rules, and raw MIME input. Attachments and bodies go to Convex file storage automatically.
convex-email threads replies to their parent messages, records whether the sender was an original recipient, and exposes parent message metadata including tags. Combined with the onInbound hook and mail.send for outbound replies, it provides the primitives needed for a support desk with reply-by-email, as documented in the included guides.
The @sayedhfatimi/convex-email component stores sent, delivered, bounced, complained, and other delivery events directly on the message record. An optional onEvent hook lets your Convex mutation react to each status change, giving you a queryable delivery audit trail without a separate webhook handler.
convex-email automatically suppresses addresses that produce hard bounces or complaints, blocking future sends to those addresses. It also generates RFC 8058 List-Unsubscribe headers with signed links per category, and an optional onUnsubscribe hook notifies your application when a recipient opts out.
@sayedhfatimi/convex-email supports Resend and Amazon SES for both sending and receiving. You can switch the active send provider by changing the sendVia config value. Suppressions, unsubscribes, and thread history persist across provider switches. The component has been tested live against both providers.
convex-email runs entirely in Convex's default runtime and contains no files marked 'use node'. HTML cleaning, SNS signature verification, and SigV4 request signing all use runtime-neutral libraries, which is required because Convex components cannot include Node.js-only files.
Your application provides a credentials callback that returns provider secrets per request. The component uses those credentials in memory and never persists them to the database. This pattern allows a single Convex deployment to serve multiple tenants, each using their own Resend or SES account.
Test mode is enabled by default in convex-email, which means outbound email is only delivered to addresses you explicitly allowlist. No real email is sent until you either add an address to the allowlist or turn test mode off. This prevents accidental sends during development and staging.
Install the package with npm install @sayedhfatimi/convex-email, then mount it in your convex/convex.config.ts file by importing the email config and calling app.use(email). The component requires convex version 1.51.1 or later. After mounting, create a convex/email.ts file with your Email client instance and credentials callback.