By: Jesús JM user 04 Jul 2019 at 4:37 a.m. CDT

8 Responses
Jesús JM gravatar
Hi guys, I'm trying to configure the SMTP server for Gmail and it seems to be not working. The server configuration is the following: * SMTP Host: smtp.gmail.com * From Name: Gluu App * From Email Address: mygmailaddress@gmail.com * Requires Authentication: Yes * SMTP User Name: mygmailaddress@gmail.com * SMTP Password: xxxxxxxxxxx * Requires SSL: Yes * Trust Server: No * SMTP Port: 465 When I test this configuration, it fails. The /opt/gluu/jetty/identity/logs/oxtrust.log report the following error: ``` ... 2019-07-04 09:05:53,934 INFO [qtp804611486-59977] [org.gluu.oxtrust.action.UpdateOrganizationAction] (UpdateOrganizationAction.java:255) - HostName: smtp.gmail.com Port: 465 RequireSSL: true RequireSSL: true 2019-07-04 09:05:53,941 ERROR [qtp804611486-59977] [org.xdi.service.MailService] (MailService.java:141) - Failed to send message javax.mail.MessagingException: Unknown SMTP host: smtp.gmail.com at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1959) ~[javax.mail.glassfish-1.4.1.v201005082020.jar:?] at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654) ~[javax.mail.glassfish-1.4.1.v201005082020.jar:?] at javax.mail.Service.connect(Service.java:310) ~[javax.mail.glassfish-1.4.1.v201005082020.jar:?] at javax.mail.Service.connect(Service.java:169) ~[javax.mail.glassfish-1.4.1.v201005082020.jar:?] at javax.mail.Service.connect(Service.java:118) ~[javax.mail.glassfish-1.4.1.v201005082020.jar:?] at javax.mail.Transport.send0(Transport.java:188) ~[javax.mail.glassfish-1.4.1.v201005082020.jar:?] ... ``` I've checked for connectivity issues inside my server and it seems to be all OK, I can reach smtp.gmail.com without any issues. The server is not behind a firewall either. Any ideas on this? Thank you very much!

By Thomas Gasmyr Mougang staff 04 Jul 2019 at 5:21 a.m. CDT

Thomas Gasmyr Mougang gravatar
use 587 as SMTP port

By Jesús JM user 04 Jul 2019 at 5:28 a.m. CDT

Jesús JM gravatar
Hi Thomas, Thanks for your reply! I've just done the test with SMTP port 587 and it throws the same exception. ``` 2019-07-04 10:27:04,501 INFO [qtp804611486-12] [org.gluu.oxtrust.action.UpdateOrganizationAction] (UpdateOrganizationAction.java:255) - HostName: smtp.gmail.com Port: 587 RequireSSL: true RequireSSL: true 2019-07-04 10:27:04,505 ERROR [qtp804611486-12] [org.xdi.service.MailService] (MailService.java:141) - Failed to send message javax.mail.MessagingException: Unknown SMTP host: smtp.gmail.com ```

By Thomas Gasmyr Mougang staff 04 Jul 2019 at 5:37 a.m. CDT

Thomas Gasmyr Mougang gravatar
- SMTP Host: smtp.gmail.com - From Name: Gluu App - From Email Address: mygmailaddress@gmail.com - Requires Authentication: Yes - SMTP User Name: mygmailaddress@gmail.com - SMTP Password: xxxxxxxxxxx - Requires SSL: Yes - Trust Server: Yes - SMTP Port: 587 Also make sure the gmail account **mygmailaddress@gmail.com** is configure to authorize external apps to send the mails.

By Jesús JM user 04 Jul 2019 at 5:44 a.m. CDT

Jesús JM gravatar
Hi Thomas, I've updated the settings as you suggested. Also, the gmail account is configured properly, as I have another services using it as SMTP server. Again, the same exception ``` 2019-07-04 10:39:37,583 INFO [qtp804611486-11] [org.gluu.oxtrust.action.UpdateOrganizationAction] (UpdateOrganizationAction.java:255) - HostName: smtp.gmail.com Port: 587 RequireSSL: true RequireSSL: true 2019-07-04 10:39:37,586 ERROR [qtp804611486-11] [org.xdi.service.MailService] (MailService.java:141) - Failed to send message javax.mail.MessagingException: Unknown SMTP host: smtp.gmail.com ```

By Thomas Gasmyr Mougang staff 04 Jul 2019 at 5:52 a.m. CDT

Thomas Gasmyr Mougang gravatar
That is suppose to work. Check **trust server** and make sure you can ping smtp.gmail.com from gluu server.

By Jesús JM user 04 Jul 2019 at 6:09 a.m. CDT

Jesús JM gravatar
The config settings are set as you suggested. I can ping smtp.gmail.com from my server machine. ``` jesus@iamserver:~$ ping smtp.gmail.com PING gmail-smtp-msa.l.google.com (74.125.140.108) 56(84) bytes of data. 64 bytes from wq-in-f108.1e100.net (74.125.140.108): icmp_seq=1 ttl=42 time=32.6 ms 64 bytes from wq-in-f108.1e100.net (74.125.140.108): icmp_seq=2 ttl=42 time=32.7 ms 64 bytes from wq-in-f108.1e100.net (74.125.140.108): icmp_seq=3 ttl=42 time=32.7 ms ``` I've tried to login into Gluu chroot container (running service gluu-server-3.1.6 login) and ping from there, but ping isn't available.

By Thomas Gasmyr Mougang staff 04 Jul 2019 at 6:35 a.m. CDT

Thomas Gasmyr Mougang gravatar
You have a problem somewhere, i check it ans it works well.

By Jesús JM user 04 Jul 2019 at 7:02 a.m. CDT

Jesús JM gravatar
How is "You have a problem somewhere" a good reply from staff? Connectivity is good from my server. I can reach gmail domain with no issues. This is an issue with tool itself.