Auth provider email (password reset, magic links, verification)

Many auth stacks let you bring your own email for password reset, magic links, verification, and OTP messages. Ranla is built for that traffic over the HTTP API, with SMTP relay when a provider only accepts custom SMTP.

For standalone send examples and copy patterns, see Password reset email best practices.


Pattern (all providers)

  1. Verify yourdomain.com (or a TX subdomain) in Ranla
  2. Create an rnl_... API key
  3. In the auth provider’s email hook, custom mailer, or your app’s auth callback, send with Ranla
  4. Keep from on your verified domain
  5. Optionally subscribe to webhooks for delivery, bounce, and complaint events
import { Ranla } from '@supersend/ranla'

const tx = new Ranla(process.env.RANLA_API_KEY)

export async function sendAuthEmail({
  to,
  subject,
  html,
  text,
}: {
  to: string
  subject: string
  html: string
  text?: string
}) {
  return tx.emails.send({
    from: '[email protected]',
    to,
    subject,
    html,
    text,
  })
}

Use this helper from password-reset, verification, and magic-link paths so every auth message shares one authenticated identity.


Supabase

Use the Send Email auth hook with an Edge Function that calls POST /emails, or configure Supabase custom SMTP with a Ranla SMTP credential (host smtp.supersendtx.com, username supersendtx). Full hook setup: Supabase Auth email.

For local testing before your domain verifies, use the Ranla sandbox sender limited to your account email (Quickstart).


Clerk

Clerk has no custom SMTP form for auth templates. Turn off Delivered by Clerk, listen for email.created, and deliver with supersendtx-clerk:

import { verifyWebhook } from '@clerk/nextjs/webhooks'
import { createClerkEmailDeliverer } from 'supersendtx-clerk'

const deliver = createClerkEmailDeliverer({
  from: '[email protected]',
})

export async function POST(req: Request) {
  const evt = await verifyWebhook(req)
  if (evt.type === 'email.created') {
    await deliver(evt.data)
  }
  return new Response('ok')
}

Full walkthrough: Clerk email.


Auth.js (NextAuth)

Use the drop-in Ranla email provider for magic links and verification flows:

import NextAuth from 'next-auth'
import SuperSendTX from 'supersendtx-authjs'

export const { handlers, auth, signIn, signOut } = NextAuth({
  adapter: /* database adapter required */,
  providers: [
    SuperSendTX({ from: '[email protected]' }),
  ],
})

Set AUTH_SUPERSENDTX_KEY or RANLA_API_KEY. Full walkthrough: Auth.js / NextAuth email.


Better Auth

Better Auth uses sendVerificationEmail / sendResetPassword callbacks — wire those to POST /emails (or the npm SDK) with the same from domain as your other TX mail. Full walkthrough: Better Auth email.


Checklist

  • Domain verified in Ranla (SPF / DKIM / return-path)
  • from matches that domain (prefer a transactional subdomain)
  • Password reset, verification, and magic-link paths all use the same sender identity
  • Secrets only in server env (RANLA_API_KEY)
  • HTML and plain-text bodies on auth sends
  • Webhooks optional but recommended for delivery/bounce visibility
  • Sandbox used only for self-tests before production cutover