Email SDK
Adapters

SendGrid

Configure the Twilio SendGrid Mail Send API adapter.

SendGrid logo
SendGrid
@opencoredev/email-sdk/sendgrid
OfficialPayload-testedLive account required
Open website

Before live sends

Create a SendGrid API key with Mail Send permission and verify the sender identity or domain used in from. SendGrid account review, sandbox mode, or sender verification can block delivery even when the SDK payload validates.

import { createEmailClient } from "@opencoredev/email-sdk";
import { sendgrid } from "@opencoredev/email-sdk/sendgrid";

const email = createEmailClient({
  adapters: [sendgrid({ apiKey: process.env.SENDGRID_API_KEY! })],
});

Options

OptionTypeRequiredNotes
apiKeystringYesSendGrid API key.
baseUrlstringNoDefaults to https://api.sendgrid.com.
fetchtypeof fetchNoUseful for tests or custom runtimes.

See field support for headers, tags, metadata, and attachments.

CLI

SENDGRID_API_KEY="SG..." npx --yes --package @opencoredev/email-sdk email-sdk send --adapter sendgrid --from hello@example.com --to user@example.com --subject "Hello" --text "It works"

On this page