Problem
Self-hosted Nango can only send transactional email (verification, invites, usage notifications) through Mailgun's API or SMTP:
// packages/email/lib/client.ts
if (envs.MAILGUN_API_KEY) {
this.provider = new MailgunEmailProvider();
} else if (envs.SMTP_URL) {
this.provider = new SmtpEmailProvider();
} else {
this.provider = new NoEmailProvider();
}
In deployments where outbound SMTP is blocked and Mailgun isn't the vendor of choice, there is no working configuration. NoEmailProvider only logs, so those emails are silently never delivered.
Proposal
Add a generic HTTP provider implementing the existing EmailProvider<T> interface, configured entirely by env vars, so any JSON-over-HTTP mail API (SendGrid, Resend, Postmark, ...) can be used without a vendor-specific module. No new dependency is needed — fetch is built in on the supported Node (>= 20), unlike the Mailgun path which pulls mailgun.js + form-data.
Rough shape:
EMAIL_HTTP_URL=https://api.sendgrid.com/v3/mail/send
EMAIL_HTTP_HEADERS={"Authorization":"Bearer <key>"}
EMAIL_HTTP_BODY=<JSON template with {{to}} / {{from}} / {{subject}} / {{html}}>
Selection would slot into the existing precedence chain after SMTP, so behaviour is unchanged for anyone already configured.
Questions before I open a PR
- Is a generic template-driven provider the direction you'd want, or would you rather see a vendor-specific
SendGridEmailProvider sitting next to MailgunEmailProvider?
packages/email has no tests today (vitest is already a devDependency). I'd add the first ones covering this provider — any objection?
Happy to send the PR once you confirm the direction.
Problem
Self-hosted Nango can only send transactional email (verification, invites, usage notifications) through Mailgun's API or SMTP:
In deployments where outbound SMTP is blocked and Mailgun isn't the vendor of choice, there is no working configuration.
NoEmailProvideronly logs, so those emails are silently never delivered.Proposal
Add a generic HTTP provider implementing the existing
EmailProvider<T>interface, configured entirely by env vars, so any JSON-over-HTTP mail API (SendGrid, Resend, Postmark, ...) can be used without a vendor-specific module. No new dependency is needed —fetchis built in on the supported Node (>= 20), unlike the Mailgun path which pullsmailgun.js+form-data.Rough shape:
Selection would slot into the existing precedence chain after SMTP, so behaviour is unchanged for anyone already configured.
Questions before I open a PR
SendGridEmailProvidersitting next toMailgunEmailProvider?packages/emailhas no tests today (vitest is already a devDependency). I'd add the first ones covering this provider — any objection?Happy to send the PR once you confirm the direction.