> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hiveku.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Customize Authentication Email Templates

> Edit the emails your users receive when they sign up, reset passwords, or verify their email

Customize the transactional auth emails your users receive from your app — signup confirmations, password resets, magic links, and more. These are the emails sent by your Supabase Auth layer, not marketing emails.

<Info>
  Before you start: [Set up user authentication](/how-tos/setup-auth) so your project has an auth database. Auth email templates only apply once auth is enabled.
</Info>

## Where to Find Templates

In your project, go to **Database > Auth > Templates** tab.

You'll see six templates you can customize, each with its own subject line, HTML body, and plain-text fallback.

| Template             | When it's sent                                              |
| -------------------- | ----------------------------------------------------------- |
| **Confirmation**     | After signup, to verify the user's email address            |
| **Invite**           | When you invite someone to your team or app                 |
| **Recovery**         | When a user requests a password reset                       |
| **Magic Link**       | For passwordless login                                      |
| **Email Change**     | When a user updates their email, to confirm the new address |
| **Reauthentication** | Before a sensitive action, to re-verify identity            |

## Edit a Template

<Steps>
  <Step title="Open the Templates tab">
    Go to **Database > Auth > Templates** and click the template you want to edit.
  </Step>

  <Step title="Update the subject line">
    The subject is what users see in their inbox list. Keep it short and specific — *"Confirm your email for Acme"* beats *"Email confirmation"*.
  </Step>

  <Step title="Edit the HTML body">
    Write or paste HTML with inline CSS. External stylesheets won't load in most email clients. Use Supabase template variables to insert dynamic values (see below).
  </Step>

  <Step title="Add a plain-text version">
    Recommended. Some email clients default to plain text, and spam filters like it when both are present. Include the same action link in plain form.
  </Step>

  <Step title="Preview">
    Click **Preview** to see the rendered HTML with example data. Fix any layout issues before saving.
  </Step>

  <Step title="Save">
    Click **Save**. The new template takes effect for the next email sent.
  </Step>
</Steps>

## Template Variables

Supabase uses Go-style template syntax. The most common variables:

| Variable                 | What it returns                              |
| ------------------------ | -------------------------------------------- |
| `{{ .ConfirmationURL }}` | The action link (confirm, reset, magic link) |
| `{{ .Token }}`           | The OTP code for manual entry                |
| `{{ .Email }}`           | The recipient's email address                |
| `{{ .SiteURL }}`         | Your configured site URL                     |
| `{{ .RedirectTo }}`      | The post-action redirect URL, if set         |

<Warning>
  Use the exact syntax `{{ .VariableName }}` with the leading dot. If your emails arrive showing literal `{{ .ConfirmationURL }}` text, you're missing the dot or a space.
</Warning>

## Example: Branded Confirmation Email

```html theme={null}
<!DOCTYPE html>
<html>
  <body style="font-family: -apple-system, sans-serif; background: #f6f9fc; padding: 40px 0;">
    <table align="center" style="max-width: 520px; background: white; border-radius: 8px; padding: 40px;">
      <tr>
        <td>
          <img src="https://yoursite.com/logo.png" alt="Your Brand" style="height: 32px; margin-bottom: 24px;" />
          <h1 style="color: #111; font-size: 22px; margin: 0 0 16px;">Confirm your email</h1>
          <p style="color: #555; line-height: 1.6;">
            Thanks for signing up. Click the button below to confirm your email address.
          </p>
          <a href="{{ .ConfirmationURL }}"
             style="display: inline-block; background: #4f46e5; color: white; padding: 12px 24px; border-radius: 6px; text-decoration: none; margin: 24px 0;">
            Confirm email
          </a>
          <p style="color: #888; font-size: 13px;">
            Or paste this link into your browser:<br />
            <span style="color: #4f46e5;">{{ .ConfirmationURL }}</span>
          </p>
        </td>
      </tr>
    </table>
  </body>
</html>
```

<Tip>
  Keep templates under 100KB. Email clients clip longer messages, and users won't see the action link.
</Tip>

## SMTP Is Required

Auth emails only send once SMTP is configured. You have two options on the **SMTP** tab of the same Auth page:

* **Hiveku Email** — use your project's built-in email service (easiest, no setup)
* **Custom SMTP** — bring your own provider (SendGrid, Postmark, your own SMTP server)

If SMTP isn't configured, templates will save but no emails go out.

## Verify Your Changes

<Steps>
  <Step title="Sign up as a test user">
    Use an email address you control (a `+test` alias is handy).
  </Step>

  <Step title="Check the inbox">
    Confirm the new subject, branding, and content show correctly.
  </Step>

  <Step title="Click the action link">
    Verify the link works — it should confirm the account, reset the password, or whatever that template is for.
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Template saved but no email arrives">
    SMTP isn't configured yet. Go to the **SMTP** tab and either enable Hiveku Email or add your provider's credentials. Without SMTP, auth emails are queued but never sent.
  </Accordion>

  <Accordion title="Variables showing as literal `{{ .Variable }}` text">
    Use exact Go template syntax — `{{ .ConfirmationURL }}` with a leading dot and spaces around the variable. A missing dot or a typo in the variable name means it's rendered as literal text.
  </Accordion>

  <Accordion title="Emails landing in spam">
    Your sending domain isn't verified. See [Email domains](/email/domains) to add SPF, DKIM, and DMARC records. Unverified domains get filtered aggressively.
  </Accordion>

  <Accordion title="HTML looks broken in Gmail or Outlook">
    Email clients strip external CSS. Use only inline styles. Avoid flexbox and grid — use tables for layout. Test with the **Preview** button and with real test emails across clients.
  </Accordion>

  <Accordion title="Links in the email go to localhost">
    Your Site URL is still pointing at a dev address. Update **Site URL** under **Database > Auth > URL Configuration** to your production domain.
  </Accordion>
</AccordionGroup>

## What's Next?

<CardGroup cols={2}>
  <Card title="Set Up User Authentication" icon="user-lock" href="/how-tos/setup-auth">
    Enable signup, login, and password reset flows
  </Card>

  <Card title="Email Domains" icon="globe" href="/email/domains">
    Verify your sending domain so emails land in the inbox
  </Card>
</CardGroup>
