> ## Documentation Index
> Fetch the complete documentation index at: https://datum-4926dda5-docs-api-reference-demo.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# EmailTemplate

> EmailTemplate is the Schema for the email templates API. It represents a reusable e-mail template that can be rendered by substituting the declared variables.

<Note>
  **Platform-provided resource.** Datum operates this resource; you typically reference or read it rather than create it. See [Platform resources](/api/platform/overview).
</Note>

<Note>
  API resource reference for **EmailTemplate**. See [Platform resources](/api/platform/overview) for related platform-provided resources. To read or inspect, see [Reading resources](/datumctl/resources/reading).
</Note>

<Warning>
  This resource is part of the `v1alpha1` API and is subject to change. Fields and behavior may change in future releases.
</Warning>

## Identity

|         |                             |
| ------- | --------------------------- |
| Group   | `notification.miloapis.com` |
| Version | `v1alpha1`                  |
| Kind    | `EmailTemplate`             |
| Scope   | Platform                    |

## Overview

An `EmailTemplate` is a reusable e-mail template that Datum Cloud renders when it needs to send a notification. The template defines a subject line along with HTML and plain-text bodies written as Go template strings, and it enumerates the variables that callers are expected to provide when the message is rendered. Use it to standardize the wording and formatting of notification e-mails so the same content can be produced consistently by substituting the declared variables at send time.

## Spec fields

| Field                       | Type      | Required | Description                                                                                 |
| --------------------------- | --------- | -------- | ------------------------------------------------------------------------------------------- |
| `spec.subject`              | string    | Yes      | The string that composes the email subject line.                                            |
| `spec.htmlBody`             | string    | Yes      | The string for the HTML representation of the message.                                      |
| `spec.textBody`             | string    | Yes      | The Go template string for the plain-text representation of the message.                    |
| `spec.variables`            | \[]Object | No       | Enumerates all variables that can be referenced inside the template expressions.            |
| `spec.variables[].name`     | string    | Yes      | The identifier of the variable as it appears inside the Go template (e.g. `{{.UserName}}`). |
| `spec.variables[].required` | boolean   | Yes      | Whether the variable must be provided when rendering the template.                          |
| `spec.variables[].type`     | string    | Yes      | A hint about the expected value of this variable. One of `string` or `url`.                 |

## Status fields (read-only)

| Field               | Type      | Description                                                                                            |
| ------------------- | --------- | ------------------------------------------------------------------------------------------------------ |
| `status.conditions` | \[]Object | Latest available observations of the template's current state, indicating whether it is ready for use. |

## Usage

```yaml theme={null}
apiVersion: notification.miloapis.com/v1alpha1
kind: EmailTemplate
metadata:
  name: welcome-email
spec:
  subject: "Welcome to Datum Cloud, {{.UserName}}"
  htmlBody: "<p>Hello {{.UserName}}, visit <a href=\"{{.DashboardURL}}\">your dashboard</a> to get started.</p>"
  textBody: "Hello {{.UserName}}, visit {{.DashboardURL}} to get started."
  variables:
    - name: UserName
      required: true
      type: string
    - name: DashboardURL
      required: true
      type: url
```

```bash theme={null}
datumctl apply -f emailtemplate.yaml
datumctl get emailtemplates
datumctl describe emailtemplate welcome-email
```

<Tip>
  Run `datumctl explain emailtemplates --recursive` to see the full, live field tree for this resource.
</Tip>
