# Threat Detected Email Template

Learn when FusionAuth sends the email for a login from a new device or a suspicious login, and which variables the template receives.

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

> **PLAN:** This feature requires [an Enterprise plan](https://fusionauth.io/docs/concepts/plans-and-limits/plans-features.md#enterprise-features).

FusionAuth sends this email when a user logs in from a new device, or when a login is suspicious. The default template handles both cases by checking **`event.type`**. Assign the template in **Login with new device**, **Suspicious login**, or both, on the Tenants -> Your Tenant -> Identities tab. To override the template for one Application, set the template on the Applications -> Your Application -> Identities tab. For more about the events, see [Advanced Threat Detection](https://fusionauth.io/docs/security/account-protection/advanced-threat-detection.md).

## Default Template

FusionAuth ships the following default template:

```ftl
[#-- @ftlvariable name="event" type="io.fusionauth.domain.event.UserLoginSuspiciousEvent" --]
[#setting url_escaping_charset="UTF-8"]
[#if event.type == "UserLoginSuspicious"]
  <p>A suspicious login was made on your account. If this was you, you can safely ignore this email. If this wasn't you, we recommend that you change your password as soon as possible.</p>
[#elseif event.type == "UserLoginNewDevice"]
  <p>A login from a new device was detected on your account. If this was you, you can safely ignore this email. If this wasn't you, we recommend that you change your password as soon as possible.</p>
[#else]
  <p>Suspicious activity has been observed on your account. In order to secure your account, it is recommended to change your password at your earliest convenience.</p>
[/#if]

<p>Device details</p>
<ul>
  <li><strong>Device name:</strong> ${(event.info.deviceName)!'&mdash;'}</li>
  <li><strong>Device description:</strong> ${(event.info.deviceDescription)!'&mdash;'}</li>
  <li><strong>Device type:</strong> ${(event.info.deviceType)!'&mdash;'}</li>
  <li><strong>User agent:</strong> ${(event.info.userAgent)!'&mdash;'}</li>
</ul>

<p>Event details</p>
<ul>
  <li><strong>IP address:</strong> ${(event.info.ipAddress)!'&mdash;'}</li>
  <li><strong>City:</strong> ${(event.info.location.city)!'&mdash;'}</li>
  <li><strong>Country:</strong> ${(event.info.location.country)!'&mdash;'}</li>
  <li><strong>Zipcode:</strong> ${(event.info.location.zipcode)!'&mdash;'}</li>
  <li><strong>Lat/long:</strong> ${(event.info.location.latitude)!'&mdash;'}/${(event.info.location.longitude)!'&mdash;'}</li>
</ul>

- FusionAuth Admin
```

```ftl
[#setting url_escaping_charset="UTF-8"]
[#if event.type == "UserLoginSuspicious"]
A suspicious login was made on your account. If this was you, you can safely ignore this email. If this wasn't you, we recommend that you change your password as soon as possible.
[#elseif event.type == "UserLoginNewDevice"]
A login from a new device was detected on your account. If this was you, you can safely ignore this email. If this wasn't you, we recommend that you change your password as soon as possible.
[#else]
Suspicious activity has been observed on your account. In order to secure your account, it is recommended to change your password at your earliest convenience.
[/#if]

Device details

* Device name: ${(event.info.deviceName)!'&mdash;'}
* Device description: ${(event.info.deviceDescription)!'&mdash;'}
* Device type: ${(event.info.deviceType)!'&mdash;'}
* User agent: ${(event.info.userAgent)!'&mdash;'}

Event details

* IP address: ${(event.info.ipAddress)!'-'}
* City: ${(event.info.location.city)!'-'}
* Country: ${(event.info.location.country)!'-'}
* Zipcode: ${(event.info.location.zipcode)!'-'}
* Lat/long: ${(event.info.location.latitude)!'-'}/${(event.info.location.longitude)!'-'}

- FusionAuth Admin
```

## Replacement Variables

`application`

*   Type: `Application`
*   Available since `1.28.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`.

`event`

*   Type: `Object`

The [User Login New Device](https://fusionauth.io/docs/events/reference/user/login/user-login-new-device.md) or [User Login Suspicious](https://fusionauth.io/docs/events/reference/user/login/user-login-suspicious.md) event. Device and location details are in **`event.info`**.

`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).

Related

[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)

[APIs Retrieve an Email Template API API documentation for the FusionAuth Retrieve an Email Template API. freemarker](https://fusionauth.io/docs/apis/emails/retrieve-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.
- [Two-Factor Authentication Email Template](https://fusionauth.io/docs/email/template-reference/security/two-factor-authentication.md): Learn when FusionAuth sends the email that contains a two-factor code, 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.
