# Smtp with OAuth2

**URL:** <https://forum.keycloak.org/t/smtp-with-oauth2/27667>\
**Category:** Miscellanaeous\
**Created:** [August 29, 2024, 4:16pm UTC](https://forum.keycloak.org/t/smtp-with-oauth2/27667 "2024-08-29T16:16:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FedericoCaimi](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/federicocaimi/32/10889_2.png) [@FedericoCaimi](https://forum.keycloak.org/u/FedericoCaimi)\
**Post date:** [August 29, 2024, 4:16pm UTC](https://forum.keycloak.org/t/smtp-with-oauth2/27667/1 "2024-08-29T16:16:39Z")

</div>

Hello! I’m trying to implement 2FA with email in Keycloak, but I’ve encountered an issue where Keycloak doesn’t support SMTP with OAuth2. I’ve been reading up on this but haven’t found any workaround. Could anyone provide some guidance or suggestions?

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [August 30, 2024, 6:42am UTC](https://forum.keycloak.org/t/smtp-with-oauth2/27667/2 "2024-08-30T06:42:43Z")

</div>

> Keycloak doesn’t support SMTP with OAuth2

It doesn’t support it. The only workaround I’m aware of would be to implement your own `EmailSenderProvider` that does what you want.

---

<div class="post-metadata">

**Author:** ![FedericoCaimi](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/federicocaimi/32/10889_2.png) [@FedericoCaimi](https://forum.keycloak.org/u/FedericoCaimi)\
**Post date:** [August 30, 2024, 11:56am UTC](https://forum.keycloak.org/t/smtp-with-oauth2/27667/3 "2024-08-30T11:56:59Z")

</div>

Hello! thanks for your answer! yes i implemented a EmailSenderProviderFactory and a EmailSenderProvider to delegete that logic to an API that already works with email and OAuth2.
