# Free transactional email templates

[Groundmail/email-templates](https://github.com/Groundmail/email-templates) is a free, MIT-licensed set of 12 production-ready transactional emails. Each one comes as a React Email component, MJML, HTML and plain text, works in light and dark mode, and restyles from a single theme file.

**[Browse the live preview](https://groundmail.github.io/email-templates/)** to see every template in light and dark mode, switch formats, and copy the code. Each template also has its own page at [groundmail.dev/templates](https://groundmail.dev/templates/), with a preview, the code, subject lines and what that kind of email needs.

| Group | Templates |
|-------|-----------|
| Authentication | Password reset, magic link, email verification, one-time code |
| Account | Welcome, workspace invite, new sign-in alert, account deletion |
| Billing | Receipt, payment failed, subscription renewal, usage alert |

The templates are provider-neutral: the HTML and text files use plain `{{variable}}` placeholders, which match the [templates API](https://docs.groundmail.dev/templates) and also work with Handlebars, Mustache and most other engines.

---

## 1. Make them yours

```bash
git clone https://github.com/Groundmail/email-templates.git
cd email-templates
npm install
```

Edit `theme.ts` (product name, logo, address, colors for light and dark mode), then preview with React Email's dev server:

```bash
npm run dev
```

## 2. Create them in your account

Each template is created (or updated) under an alias that matches its folder name, such as `password-reset`, and published. Use an API key with the `templates:write` scope.

```bash
export GROUNDMAIL_API_KEY=gm_your_key_here
npm run push -- --all
# or pick some: npm run push -- password-reset receipt
```

Under the hood this is [`groundmail templates push`](https://docs.groundmail.dev/cli), so you can also push a single file yourself:

```bash
npx -y --package=groundmail-cli -- groundmail templates push templates/password-reset/password-reset.html \
  --alias password-reset \
  --name "Password reset" \
  --subject "Reset your Acme password" \
  --text templates/password-reset/password-reset.txt \
  --publish
```

To try one template without cloning, each template's README in the repo has a `curl` command that creates it from the repo's default theme.

## 3. Send

Send by alias and pass the variables the template lists:

```ts
import { Groundmail } from 'groundmail'

const groundmail = new Groundmail(process.env.GROUNDMAIL_API_KEY!)

await groundmail.emails.send({
  from: 'Acme <noreply@yourdomain.com>',
  to: 'ada@example.com',
  template: {
    id: 'password-reset',
    variables: {
      name: 'Ada',
      reset_url: 'https://yourapp.com/reset?token=…',
      expires_in: '60 minutes',
    },
  },
})
```

```python
groundmail.emails.send(
    from_="Acme <noreply@yourdomain.com>",
    to="ada@example.com",
    template={"id": "password-reset", "variables": {"name": "Ada", "reset_url": "https://yourapp.com/reset?token=…", "expires_in": "60 minutes"}},
)
```

Every template folder in the repo lists its variables and has the same send code for Node.js, Python, PHP and cURL.

### Or send the React component directly

If you'd rather keep templates in your codebase, copy the React components into your app and pass them with `react`. See [Send React Email](https://docs.groundmail.dev/guides/react-email).

```tsx
import PasswordReset from './emails/templates/password-reset/password-reset'

await groundmail.emails.send({
  from: 'Acme <noreply@yourdomain.com>',
  to: 'ada@example.com',
  subject: 'Reset your Acme password',
  react: <PasswordReset name="Ada" resetUrl="https://yourapp.com/reset?token=…" expiresIn="60 minutes" />,
})
```

---

## Dark mode and client support

The light design is always inline, so clients that strip `<style>` still show a finished email. Apple Mail, iOS Mail, Outlook for Mac and Outlook.com get the dark palette from `theme.ts`. Gmail applies its own dark-mode inversion and ignores author dark styles. Outlook for Windows shows square corners. Every template is checked against caniemail data in the repo's CI and stays well under Gmail's 102 KB clipping limit.

## Related

- [Free email templates on groundmail.dev](https://groundmail.dev/templates/)
- [Templates API](https://docs.groundmail.dev/templates)
- [Send React Email](https://docs.groundmail.dev/guides/react-email)
- [Password reset email best practices](https://docs.groundmail.dev/guides/password-reset-emails)
