Nodemailer transport for SendGrid API supporting templates, attachments, and full mail options.
// Source: https://github.com/ConduitPlatform/Conduit | License: MIT | Copyright 2022 Conduit(https://getconduit.dev)
// Provided via justclaw.it.com; keep this notice with the code.
import { Client } from '@sendgrid/client';
import type { SentMessageInfo, Transport } from 'nodemailer';
import { SendGridConfig } from './sendgrid.config.js';
type SendgridMailMessage = Parameters<Transport<SentMessageInfo>['send']>[0];
type Address = { name?: string; address: string };
type NormalizedMail = {
subject?: string;
text?: string;
html?: string;
from?: Address;
replyTo?: Address;
to?: Address[];
cc?: Address[];
bcc?: Address[];
attachments?: Array<{
content?: string;
filename?: string;
contentType?: string;
cid?: string;
}>;
alternatives?: Array<{ content?:
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key