Send transactional email from Convex actions using one typed SDK with 23 provider adapters, built-in retries, fallback routing, and field-support validation.
npm install @opencoredev/convex-emailEmail SDK provides a single TypeScript client for sending transactional email across 23 provider adapters including Resend, Postmark, SendGrid, AWS SES, and SMTP. It normalizes the message format across providers, adds retry logic and fallback routing between adapters, and surfaces unsupported field errors before data is silently dropped. Convex actions can use it server-side to trigger emails from mutations, scheduled functions, or webhooks.
Install @opencoredev/convex-email and call createEmailClient inside a Convex action with your chosen adapter, such as resend or sendgrid. The client exposes a single email.send() method that accepts a normalized message object. Because Convex actions can call third-party services, this is the correct function type for any outbound email send.
Email SDK supports retries within a single adapter and fallback routing across multiple adapters configured at client creation time. Pass an ordered array of adapters to createEmailClient and the SDK will attempt each in sequence on failure. This removes the need to write custom retry logic inside your Convex action.
Email SDK provides 23 adapters including Resend, Postmark, SendGrid, AWS SES, Mailgun, and SMTP, each imported from its own entry point. You can configure multiple adapters in one client for fallback routing, or use different clients in different actions for different send types, all sharing the same message schema.
Email SDK performs fail-fast field-support checks against the target adapter before dispatching a send. If a message includes a field the selected provider does not support, the SDK raises an error immediately rather than silently dropping the data, which prevents invisible data loss at the provider level.
Email sends must run inside a Convex action, not a mutation or query. Convex actions are designed for calling third-party services and external APIs. Import createEmailClient from @opencoredev/convex-email inside your action file and keep provider API keys in environment variables, never in client-side code.
The SDK includes 23 adapters: Resend, Postmark, SendGrid, AWS SES, Mailgun, Brevo, MailerSend, SparkPost, Mailchimp, Iterable, Loops, Plunk, Mailtrap, Cloudflare, Unosend, Scaleway, ZeptoMail, MailPace, Sequenzy, JetEmail, Lettermint, Primitive, SMTP, and a test adapter. Each adapter is imported from its own entry point, for example @opencoredev/email-sdk/resend.
Email SDK is server-side only and requires Node 20 or Bun. Convex actions run in a Node.js-compatible environment, so the SDK is compatible when used inside actions. Do not import it into client-side Convex code or browser bundles.
Email SDK ships a dedicated test adapter that never calls real provider APIs. Import it in place of your production adapter during tests. Combined with the fact that telemetry is automatically disabled when NODE_ENV=test, this makes it straightforward to write unit tests for actions that send email.
Email SDK collects anonymous usage analytics tied to a random local ID, covering adapter names, success or failure, send duration, and SDK version. Email content, subjects, recipient addresses, API keys, and attachments are never collected. You can opt out by setting EMAIL_SDK_TELEMETRY=0 or passing telemetry: false to createEmailClient.