Auth provider email (Supabase, Clerk, Auth.js)
Many auth stacks let you bring your own email for magic links, verification, and password resets. SuperSend TX is built for that traffic over the HTTP API.
Pattern (all providers)
- Verify
yourdomain.comin SuperSend TX - Create an
stx_...API key - In the auth provider’s email hook, custom mailer, or your app’s auth callback, send with SuperSend TX
- Keep
fromon your verified domain
import { SuperSendTX } from 'supersendtx'
const tx = new SuperSendTX(process.env.SUPERSENDTX_API_KEY)
export async function sendAuthEmail({
to,
subject,
html,
text,
}: {
to: string
subject: string
html: string
text?: string
}) {
return tx.emails.send({
from: 'noreply@yourdomain.com',
to,
subject,
html,
text,
})
}Supabase
Use the Send Email auth hook with an Edge Function that calls POST /emails, or configure Supabase custom SMTP with a SuperSend TX SMTP credential (host smtp.supersendtx.com, username supersendtx). Full hook setup: Supabase Auth email.
For local testing before your domain verifies, use the SuperSend TX sandbox sender limited to your account email (Quickstart).
Clerk
Clerk supports customized auth email in several ways (including SMTP on some plans). Prefer:
- A webhook or backend job when Clerk would send mail, or
- Clerk’s documented path for custom email delivery that invokes your server
Your server:
await tx.emails.send({
from: 'noreply@yourdomain.com',
to: emailAddress,
subject: 'Sign in to your account',
html: clerkProvidedHtmlOrYourTemplate,
})If you must fill Clerk’s SMTP fields, use a SuperSend TX SMTP credential (SMTP). Otherwise prefer HTTP from your app.
Auth.js (NextAuth)
In Auth.js, implement a custom sendVerificationRequest (or equivalent email provider) that calls SuperSend TX:
import { SuperSendTX } from 'supersendtx'
const tx = new SuperSendTX(process.env.SUPERSENDTX_API_KEY)
async function sendVerificationRequest({ identifier, url, provider }) {
await tx.emails.send({
from: provider.from || 'noreply@yourdomain.com',
to: identifier,
subject: 'Sign in',
html: `<p><a href="${url}">Sign in</a></p>`,
text: `Sign in: ${url}`,
})
}Wire that function into your Auth.js email provider config per Auth.js docs.
Checklist
- Domain verified in SuperSend TX
-
frommatches that domain - Secrets only in server env (
SUPERSENDTX_API_KEY) - Webhooks optional for delivery/bounce visibility
- Sandbox used only for self-tests