Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Gmail MailConnectException: Couldn't connect to host, port: smtp

SA-25016

Summary



When attempting to send email from inside the Pega 7 Platform using a Google account (Gmail) and accessing a Google SMTP mail transfer agent (MTA), the administrator observed the error:

Caught com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 25; timeout 60000

When checking the Email Integration setup, the administrator saw the Failure message:

MessagingException caught connecting to email server: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout 60000;

Here's the nested exception:

java.net.UnknownHostException: smtp.gmail.com

The Pega log shows multiple errors.

Error Messages

2016-06-21 05:58:04,817 [ PegaRULES-Batch-1] [ STANDARD] [ ] [leManagerForFS:07.21] (pega_integrationengine_default) ERROR - Unexpected exception caught while trying to send an email message with sender ID of <[email protected]> and addressee of <[email protected]>:
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. a84sm2192451wma.0 - gsmtp


2016-06-21 06:04:14,568 [http-bio-8080-exec-3] [TABTHREAD3] [ ] [leManagerForFS:07.21] (Activity.Data_EmailAccount.Action) ERROR pega|127.0.0.1 CLMFSSysAdmin - Data-EmailAccount.PegaCLMFS-Work: The server indicated that the authentication credentials for this Email Account are incorrect.
javax.mail.AuthenticationFailedException: [AUTHENTICATIONFAILED] Invalid credentials (Failure)


Steps to Reproduce



Set up your Email integration in Pega to use a GoogleMail (Gmail) account.
Follow the steps in the Help topic:

https://pdn.pega.com/sites/default/files/help_v722/procomhelpmain.htm#data-/data-emailaccount/emailaccount.htm.

Root Cause



A third-party product issue

Google
enforces strict security that cannot be achieved with JavaMail (used internally on the Pega 7 Platform) in its default configuration.


To be able to use JavaMail to send emails using Google SMTP MTA, you will need to consider lessening the Google security constraints.

However, using Port 25 is a bad idea for the Gmail SMTP server. Many corporate networks' firewalls redirect or block Port 25. Port 25 is rarely used for production environments. In most cases, Gmail is used for testing only.
Here are the correct options:
  • Port 587 - SSL checkbox not checked - uses STARTTLS
  • Port 465- SSL checkbox checked - uses SMTPS


Resolution



Consider the following approaches and choose the one that best suits your needs:



Published April 21, 2017 - Updated October 8, 2020

Was this useful?

75% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice