> Source: https://docs.cyberelements.io/saas/hu/Usage/Administration/AdminConsole/MainWorkPanel/AccessPolicies/OtpTokenGenerators/MailGenerator/

# OTP by email generator

The **OTP - email** generator sends the one-time code by electronic message. It is the easiest channel to set up: all it needs is an SMTP server, already required for notifications.

![](https://docs.cyberelements.io/saas/img/cyberelements/CYE_AdminConsole_OtpTokenGenerators_Mail_Edit.png)

## Scope of the second factor

> **Mailbox reachable from the workstation**
>
> A second factor is meant to rest on an element distinct from what is already compromised. If the mailbox is open on the very workstation the user connects from (webmail in a tab, mail client installed), the code arrives exactly where an attacker who had taken over that workstation would be. The channel keeps its value against remote password theft; it loses most of it against workstation compromise.
>
> The second factor is cancelled entirely when the two accounts are one: if the user signs in to the platform with **the same username and password** as their mailbox (the common case of a single directory for the whole organisation), whoever stole the password also opens the mailbox, and therefore receives the code. The second factor then rests on no distinct element.

This channel is therefore best suited as a **fallback channel** or a transitional step, rather than as the second factor of a privileged access.

## Setup

1. Declare an [SMTP server](https://docs.cyberelements.io/saas/hu/Usage/Administration/AdminConsole/ConfigurationWorkPanel/SmtpServers/).
2. Create the generator: choose the server, the sender address, the **message subject** and the text preceding the code.
3. Associate it with an [authentication domain](https://docs.cyberelements.io/saas/hu/Usage/Administration/AdminConsole/MainWorkPanel/AuthenticationDomains/AuthenticationDomains/).
4. Make sure users have an **address on file** in their profile.

## Code settings

The common block applies: alphabet, length (8 by default) and validity period (900 seconds by default). On this channel, the period must cover the email delivery time, which is not guaranteed.

## Limits

- Depends entirely on the **SMTP server**: its unavailability prevents authentication, not only notifications.
- Delivery is neither immediate nor guaranteed: a spam filter is enough to block authentication, with no error message the user can act on.
- A user **with no address** in their profile cannot receive a code, and therefore can no longer log in once the generator is associated with their domain.

---

The details of the fields are described in the [module reference](https://docs.cyberelements.io/saas/hu/Usage/AdminConsoleReference/OtpTokenGenerators/).
