# `Sigra.EmailTemplates`
[🔗](https://github.com/sztheory/sigra/blob/v1.20.0/lib/sigra/email_templates.ex#L1)

Behaviour for generated email template modules.

The generated `MyApp.Auth.Emails` module implements this behaviour.
Each callback builds a map with `:to`, `:subject`, and `:body` keys
that can be delivered via `Sigra.Delivery`.

## Security Notification Emails

These templates are called by the library layer inside `Auth.authenticate/2`
to ensure security notifications are always sent, regardless of how the
developer's generated code calls authenticate.

# `api_token_created_email`
*since 0.7.0* 

```elixir
@callback api_token_created_email(user :: struct(), token :: struct()) :: map()
```

Build an API token created notification email.

# `confirmation_email`
*since 0.3.0* 

```elixir
@callback confirmation_email(user :: struct(), url :: String.t(), code :: String.t()) ::
  map()
```

Build a confirmation email.

# `deletion_cancelled_email`
*since 0.8.0* 

```elixir
@callback deletion_cancelled_email(user :: struct(), login_url :: String.t()) :: map()
```

Build deletion cancelled confirmation email.

# `deletion_finalized_email`
*since 0.8.0* 

```elixir
@callback deletion_finalized_email(email :: String.t()) :: map()
```

Build deletion finalized notification email.

# `deletion_scheduled_email`
*since 0.8.0* 

```elixir
@callback deletion_scheduled_email(
  user :: struct(),
  scheduled_date :: DateTime.t(),
  cancel_url :: String.t()
) :: map()
```

Build deletion scheduled notification email.

# `email_change_confirmation_email`
*since 0.8.0* 

```elixir
@callback email_change_confirmation_email(
  user :: struct(),
  new_email :: String.t(),
  url :: String.t()
) :: map()
```

Build email change confirmation email to new address.

# `email_change_notification_email`
*since 0.8.0* 

```elixir
@callback email_change_notification_email(
  user :: struct(),
  new_email :: String.t(),
  cancel_url :: String.t()
) :: map()
```

Build email change notification email to old address.

# `email_changed_email`
*since 0.8.0* 

```elixir
@callback email_changed_email(user :: struct()) :: map()
```

Build post-email-change confirmation email to new address.

# `lockout_notification_email`
*since 0.4.0* 

```elixir
@callback lockout_notification_email(user :: struct(), details :: map()) :: map()
```

Build an account lockout notification email.

# `magic_link_email`
*since 0.3.0* 

```elixir
@callback magic_link_email(user :: struct(), url :: String.t()) :: map()
```

Build a magic link email.

# `password_changed_email`
*since 0.8.0* 

```elixir
@callback password_changed_email(user :: struct(), details :: map()) :: map()
```

Build password change notification email.

# `reset_password_email`
*since 0.3.0* 

```elixir
@callback reset_password_email(user :: struct(), url :: String.t()) :: map()
```

Build a password reset email.

# `suspicious_login_email`
*since 0.4.0* 

```elixir
@callback suspicious_login_email(user :: struct(), details :: map()) :: map()
```

Build a suspicious login notification email.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
