
[[_email_config]]
= Email

Keycloak sends emails to users to verify their email address.
Emails are also used to allow users to safely restore their username and passwords. 

== Email Server Config

To enable Keycloak to send emails you need to provide Keycloak with your SMTP server settings.
If you don't have a SMTP server you can use one of many hosted solutions (such as Sendgrid or smtp2go). 

To configure your SMTP server, open the `Keycloak Admin Console`, select your realm from the drop-down box in the top left corner.
Then click on `Email` in the menu at the top. 

You are required to fill in the `Host` and `Port` for your SMTP server (the default port for SMTP is 25). You also have to specify the sender email address (`From`). The other options are optional. 

The screenshot below shows a simple example where the SMTP server doesn't use SSL or TLS and doesn't require authentication. 

== Enable SSL or TLS

As emails are used for recovering usernames and passwords it's recommended to use SSL or TLS, especially if the SMTP server is on an external network.
To enable SSL click on `Enable SSL` or to enable TLS click on `Enable TLS`.
You will most likely also need to change the `Port` (the default port for SSL/TLS is 465). 

== Authentication

If your SMTP server requires authentication click on `Enable Authentication` and insert the `Username` and `Password`. 
