# Two-Factor Authentication Email Template

Learn when FusionAuth sends the email that contains a two-factor code, and which variables the template receives.

> For the index of this section of the site, see [llms.txt](https://fusionauth.io/docs/llms.txt)

FusionAuth sends this email with a code when a user completes a multi-factor login with the email method, or enables or disables the email method. Assign the template in **Template** under Tenants -> Your Tenant -> Multi-Factor -> Email settings . To override the template for one Application, set **Email template** on the Application's Multi-Factor tab.

## Default Template

FusionAuth ships the following default template:

```ftl
<p>
  To complete your login request, enter this one-time code code on the login form when prompted.
</p>
<p>
  <strong>${code}</strong>
</p>

- FusionAuth Admin
```

```ftl
To complete your login request, enter this one-time code code on the login form when prompted.

${code}

- FusionAuth Admin
```

## Replacement Variables

`application`

*   Type: `Application`
*   Available since `1.46.0`

The Application object. For field definitions, see the [Application API](https://fusionauth.io/docs/apis/applications.md).

The variable is present only when the request that sends the email identifies an Application. Check for the variable before you use it:

```ftl
[#if application??]
  ${application.name}
[/#if]
```

`baseUrl`

*   Type: `String`
*   Available since `1.68.0`

The base URL for links in the email. FusionAuth uses the Application **baseURL**, then the Tenant **baseURL**, then `http://localhost:9011`.

`code`

*   Type: `String`

The code the user enters to complete multi-factor authentication.

`tenant`

*   Type: `Tenant`
*   Available since `1.18.2`

The Tenant object. For field definitions, see the [Tenant API](https://fusionauth.io/docs/apis/tenants.md).

`user`

*   Type: `User`

The User object for the recipient. For field definitions, see the [User API](https://fusionauth.io/docs/apis/users.md).

The **`application`** variable is missing when a request that sends the code has no **`applicationId`**. The requests are the following:

*   [Start Multi-Factor](https://fusionauth.io/docs/apis/two-factor/start-multi-factor.md).
*   The [Login API](https://fusionauth.io/docs/apis/login/authenticate.md), when multi-factor authentication is required. A production login request should always include **`applicationId`**.
*   The requests that send a code to [enable](https://fusionauth.io/docs/apis/two-factor/send-a-multi-factor-code-when-enabling-mfa.md) or [disable](https://fusionauth.io/docs/apis/two-factor/send-a-multi-factor-code-when-disabling-mfa.md) a method.

Related

[Messengers Message Template Reference A list of default message templates. multi-factor authenticationfreemarker](https://fusionauth.io/docs/messengers/template-reference.md)

[APIs Create an Email Template API API documentation for the FusionAuth Create an Email Template API. freemarker](https://fusionauth.io/docs/apis/emails/create-an-email-template.md)

[APIs Email API Learn about the APIs for creating, retrieving, updating and deleting email templates as well as sending emails to users. freemarker](https://fusionauth.io/docs/apis/emails.md)

[APIs Preview an Email Template API API documentation for the FusionAuth Preview an Email Template API. freemarker](https://fusionauth.io/docs/apis/emails/preview-an-email-template.md)
---

## Other pages in Security

> For the full index of this section, see [Email](https://fusionauth.io/docs/llms-email.txt).

- [Admin Two-Factor Method Removed Email Template](https://fusionauth.io/docs/email/template-reference/security/admin-two-factor-method-removed.md): Learn when FusionAuth sends the email that tells a user an administrator removed a two-factor method, and which variables the template receives.
- [Breached Password Email Template](https://fusionauth.io/docs/email/template-reference/security/breached-password.md): Learn when FusionAuth sends the email that warns a user about a breached password, and which variables the template receives.
- [Email Update Email Template](https://fusionauth.io/docs/email/template-reference/security/email-update.md): Learn when FusionAuth sends the email that tells a user their email address changed, and which variables the template receives.
- [Login Id Duplicate on Create Email Template](https://fusionauth.io/docs/email/template-reference/security/login-id-duplicate-on-create.md): Learn when FusionAuth sends the email that tells a user someone tried to sign up with their login Id, and which variables the template receives.
- [Login Id Duplicate on Update Email Template](https://fusionauth.io/docs/email/template-reference/security/login-id-duplicate-on-update.md): Learn when FusionAuth sends the email that tells a user another account tried to take their login Id, and which variables the template receives.
- [Password Reset Success Email Template](https://fusionauth.io/docs/email/template-reference/security/password-reset-success.md): Learn when FusionAuth sends the email that confirms a password reset, and which variables the template receives.
- [Password Update Email Template](https://fusionauth.io/docs/email/template-reference/security/password-update.md): Learn when FusionAuth sends the email that tells a user their password changed, and which variables the template receives.
- [Threat Detected Email Template](https://fusionauth.io/docs/email/template-reference/security/threat-detected.md): Learn when FusionAuth sends the email for a login from a new device or a suspicious login, and which variables the template receives.
- [Two-Factor Method Added Email Template](https://fusionauth.io/docs/email/template-reference/security/two-factor-method-added.md): Learn when FusionAuth sends the email that tells a user a two-factor method was added, and which variables the template receives.
- [Two-Factor Method Removed Email Template](https://fusionauth.io/docs/email/template-reference/security/two-factor-method-removed.md): Learn when FusionAuth sends the email that tells a user a two-factor method was removed, and which variables the template receives.
