Setup Pega 7 Google Gmail Integration

This post shows how to use the Pega 7 Email Wizard for setting up a new Pega 7 Google Gmail integration so that a Google Mail (gmail.com) account can be used in a Pega 7 application for sending and receiving emails.

Summary

  1. Pega Setup Used in this Example
  2. Enable SMTP for the Google Mail Account
  3. Create Pega 7 Email Account Rule with the Email Wizard
  4. Test the Connection to the Google Mail Account
  5. Send Automatic Email Notifications in Pega 7 with the Send Email Smart Shape

1  Pega Setup Used in this Example

For this post, Pega 7.1.6 was used with the following Pega setup:

  • Pega 7.1.6 is installed as a Personal Virtual Server (PVS) utilizing the VMWare Player.
  • For details, see the Downloading the Exercise System sections of the SAE I (7.1) and SSA (7.1) courses provided by Pega Academy.
  • Windows 7 was used as the host operating system.
  • The virtual machine’s network adapter is configured to used a bridged network connection as shown below.

VMWare Player Network Adapter Settings

  • Note: Make sure that the Pega PVS instance is able to connect to the Internet. If the Internet access is not setup properly, the connection to the Google mail server will fail.
  • As an alternative, see the below post on how to run the Pega 7 Exercise System on Tomcat 9 and PostgreSQL – without the need for a virtual machine:

2  Enable SMTP for the Google Mail Account

Log into the Google Mail account and click on the cog wheel icon in the upper right hand corner to access the account settings.

  • Click on the Forwarding and POP/IMAP tab in the settings screen
  • Under IMAP Access, make sure to turn on Enable IMAP.

Gmail Account Settings Enable IMAP

3  Create Pega 7 Email Account Rule with the Email Wizard

  • Before the Send Email smart shape can be used in a flow to automatically send emails, it is necessary to setup a new email account rule.
  • In the Designer Studio, click on Designer Studio >Integration > Email > Email Wizard.

DesignerStudio - Navigate to the Email Wizard for setup of New Pega 7 Google Gmail Integration

(1) Enter Email Information

  • On the first screen of the Email Wizard (also known as Email Accelerator), select Configure an email account in the drop-down control for What would you like to do?
  • In the second drop-down control for Which work pool will be associated with this EmailAccount?, select the applicable work pool. Here it is ABC-Insurance-Work.
  • All case types that belong to the ABC-Insurance-Work work pool will use this email account when a Send Email smart shape is used in a flow.

Email Accelerator Enter Email Information

  • Do not check the check box next to Would you like to use the Default EmailAccount key?
  • Click on the Next button to continue.

(2a) Outbound Email – Enter Account Info

  • On the next screen, click on the button Select Email Provider to let the wizard pre-fill certain parameters for some of the most common email providers.
  • In this case, the wizard is used to configure a Google Mail account, so select pxGmailDefault.

Email Accelerator Select Email Provider

  • In the From field of the Sender section, enter the email address for sending emails (outbound).
  • In this case, it is a Gmail email account called [email protected].
  • The same email address can be used for receiving emails in Pega (inbound).
  • Make sure the other parameters in the Sender section are set as follows:
Host (SMTP): smtp.gmail.com (see Simple Mail Transfer Protocol)
Port: 465
Use SSL?: Yes
User ID: Here, [email protected]
  • In the Receiver section set the parameters as follows:
Host: imap.gmail.com
Port: 993
Use SSL?: Yes

Email Accelerator Outbound Email Enter Account info

  • Click on the Set Password button in the Sender section to set the password for the sender email account. This is the password for accessing the specified Gmail account.

Email Accelerator Set Sender Password

  • Click on the Set Password button in the Receiver section to set the password for the receiver email account. Again, this is the password for accessing the specified Gmail account.

Email Accelerator Set Receiver Password

  • After setting the sender and receiver passwords, click on Next to continue. The subsequent screen shows a summary of the email account settings, click on Next to continue.

Email Accelerator Outbound Email Review Account Details

  • A confirmation screen will show a message indicating that the Email Wizard has completed setting up the email account.

Email Accelerator - The Email Configuration for Pega 7 Google Gmail Integration is now Complete

  • Click on Done to close the Email Wizard.

4  Test the Connection to the Google Mail Account

  • In the Designer Studio, navigate to Integration > Email > Email Accounts to view a list of available email accounts.
  • The previously configured Google Mail account should now appear in the list.

Integration List of Email Accounts

  • Click on the new Google Mail email account to open the Email Account rule.
  • This will open a form similar to the earlier configuration form and allows to test the connection.

Pega 7 Google Gmail Integration - Test Connectivity

  • Click on the Test Connectivity button in the Sender section. PRPC will attempt to connect to the specified Google Mail account and it will show the result in a new window.
  • At this point, the connection may fail and the result may look like the screen shot below, showing a message saying that the authentication credentials for this Email Account are incorrect.

Pega 7 Google Gmail Integration - Test Sender Connection - Result Fail

  • This is actually not the case. The reason for this error message is a default security setting of the Google Mail account. It prevents clients deemed not secure by Google from connecting.
  • The reason for this could be the fact that PRPC uses a self-signed SSL certificate. In a production environment, a SSL certificate signed by a certificate authority should be used.
  • The Google Mail account which was configured with the Email Wizard should have received a message from Google saying that a Sign-in attemtp was prevented.

Google Mail Sign-in attempt prevented

  • Login to the Google Mail account and navigate to Sign-in & security and scroll down to a section called Allow less secure apps and switch the setting from OFF to ON.

Google Mail My Account Allow less secure apps ON

  • Repeat the connection test by clicking on the Test Connection button in the Sender section.
  • The connection to the Google Mail account should now succeed with a confirmation message: Connected successfully to email server. Disconnected successfully from email server.

Pega 7 Google Gmail Integration - Test Sender - Connection Success

  • The connection test for the Receiver part of the configuration should succeed as well.
  • The result should look like the screen shot below.

Integration Email Account Receiver Test Connection Success

  • The Email rule is now ready to be used in a Send Email smart shape in a flow rule.

5  Send Automatic Email Notifications in Pega 7 with Send Email Smart Shape

  • In this example, a section is used to present a form to collect customer data. The customer’s email is entered by the operator.
  • Once the form is submitted, PRPC will automatically send a confirmation email to the customer, using the sender email account [email protected] configured in step 2.

Example Form Collect Customer Information

  • In the related flow, a Send Email smart shape is used to automatically send the confirmation email.

Flow Send Email Smart Shape

  • Right click on the Send Email smart shape to configure it.
  • Select Email address for the Send to option.
  • For Message, select Correspondence.
  • The To email address is a property of type text, here it is set to .Customer.Email.

Send Email Smart Shape Properties

  • A new correspondence template can be created using the Application Explorer.
  • Under the case type rule, right click on Process > +Create > Correspondence.

DesignerStudio Create Correspondence Template Rule

  • The correspondence rule for this example is shown in the screen shot below.
  • Properties and other dynamic content can easily be inserted into the correspondence body.

Edit Correspondence Template Rule Design Mode

  • When a new case is created, the confirmation email will be sent automatically by PRPC once the Collect Customer Information form has been submitted by the operator.
  • The customer will receive an email that looks like this:

Example Confirmation Email

  • The customer’s first name has been inserted dynamically and the sender name EMail System, configured in step 2, is shown.

4 thoughts on “Setup Pega 7 Google Gmail Integration

  1. HI ,

    I am using 7.1.9 and i followed the steps ,I could not see where to select Use SSL for Sender . it shows only Use SMTPS for sender in the screen . and i tested both sender and Receiver . Sender failed with
    java – javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465; – 1

Leave a Reply