# Can't send mails with GSuite Relay-SMTP

**URL:** <https://forum.keycloak.org/t/cant-send-mails-with-gsuite-relay-smtp/1946>\
**Category:** Configuring the server\
**Created:** [April 2, 2020, 10:16pm UTC](https://forum.keycloak.org/t/cant-send-mails-with-gsuite-relay-smtp/1946 "2020-04-02T22:16:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mckraemer](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@mckraemer](https://forum.keycloak.org/u/mckraemer)\
**Post date:** [April 2, 2020, 10:16pm UTC](https://forum.keycloak.org/t/cant-send-mails-with-gsuite-relay-smtp/1946/1 "2020-04-02T22:16:07Z")

</div>

Hi,

I am trying to send mails with my GSuite Account using the Google Relay-SMTP. In the screenshot you can see my configuration. When I press the button “Test connection” I get the error message “Failed to send mail”. Can you see something that is obvious wrong?

 ![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/1X/376af2941630fda51546e5abd6c4a67fe774fde7.png)

Thanks for any help!

Greetings  
Jan

---

<div class="post-metadata">

**Author:** ![zonaut](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/zonaut/32/666_2.png) [@zonaut](https://forum.keycloak.org/u/zonaut)\
**Post date:** [April 2, 2020, 10:53pm UTC](https://forum.keycloak.org/t/cant-send-mails-with-gsuite-relay-smtp/1946/2 "2020-04-02T22:53:46Z")

</div>

Does the user have an email configured because Keycloak uses the currently logged in user to send a test email?

---

<div class="post-metadata">

**Author:** ![mckraemer](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@mckraemer](https://forum.keycloak.org/u/mckraemer)\
**Post date:** [April 2, 2020, 11:04pm UTC](https://forum.keycloak.org/t/cant-send-mails-with-gsuite-relay-smtp/1946/3 "2020-04-02T23:04:53Z")

</div>

Yes, that was my first error, but it throws a different error message. I have fixed that issue.  
Maybe I should add some more informations. I am using the docker container. I have setup the Relay-SMTP and allowed less secure apps in the google console.

EDIT: I had to activate 2 Factor and generate a seprrate app password. Thank you for your time!

---

<div class="post-metadata">

**Author:** ![myr](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@myr](https://forum.keycloak.org/u/myr)\
**Post date:** [March 2, 2021, 9:34am UTC](https://forum.keycloak.org/t/cant-send-mails-with-gsuite-relay-smtp/1946/4 "2021-03-02T09:34:13Z")

</div>

If you have enabled keystore, then you need to add the Google CA certificate to that. I had the same issue and when i added the google CA, the email started working

keytool -import -alias google-ca -keystore truststore.jks -file googleca.cer

You can get the cer by typing [gmail.com](http://gmail.com) in your browser and then export the certifiate in base-64 format.

---

<div class="post-metadata">

**Author:** ![fernando-gg](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/fernando-gg/32/4343_2.png) [@fernando-gg](https://forum.keycloak.org/u/fernando-gg)\
**Post date:** [November 9, 2021, 3:05pm UTC](https://forum.keycloak.org/t/cant-send-mails-with-gsuite-relay-smtp/1946/5 "2021-11-09T15:05:42Z")

</div>

Hi Guys,  
I´m not able to do this.  
I´m using as base imagem: FROM jboss/keycloak:15.0.2  
And i only get “keytool error: java.io.FileNotFoundException: truststore.jks (Permission denied)”
