Sending Outbound Emails from Pega

In this blog article, we will see how we can send an outbound email from a Pega application.
This is the continuation of the previous blog article, where we created an Microsoft Graph Email Account in Pega
Requirement: As soon as a new Mortgage request is created, the case manager should be notified about the mortgage case creation.
Pre-requisites to test the outbound email.
a) Create correspondence rule – that can hold the email body
I created a simple correspondence rule – Mortgage case creation.

The correspondence was created of type email and also dynamic ingests the property value in the email body as shown above.
b) Case Manager Operator
Make sure you have a Case manager operator with the right email ID configured. I am using pegaknowledgesharing@gmail.com as the case manager email address.
Also for my current operator, I added the case manager operator as pyReportTo.
c) Case manager as workparty
We will send the email via OOTB activities and for that we will use the Case manager as the workparty.
Enjoying this content?
Access the author’s full video courses here at MyKnowAcademy.
Explore Courses →
I already did the configuration in the workparty blog article.
Below is my configuration for the workparty configuration.

I should also see the Workparty details appended with the case on creation!
Now my pre-requisites are ready. Let’s go to the testing part.
What are the different ways to send out an outbound email?
Pega provides a lot of OOTB ways to send out an outbound email.
Advanced flow shape – send email
You can add a send email automation step from the case designer, that inturn adds the flow shape in the process flow rule.
Step 1: Add the automation shape in the Mortgage case.

Step 2: Configure the Send email step.

In the Send to, we have different options and we will use sending to Case Participants options and then choose the Case Manager.

Now the email content, You can specify the Subject and compose a custom email body directly or refer the correspondence rule directly. We will use the latter option.
You can also include the case attachments if needed.

Step 3: Test the Send email step.
Now Save the case type and create a new Mortgage request case.
As a first step, you can already the email attachment with the case.

You also see the email is received successfully in the gmail client

Before ending this blog article, let’s also understand the architecture behind this send correspondence part.
How Pega send out the outbound email?
An important thing to note is Pega always sends the email in asynchronous way so that nothing gets blocked from user portal (in case of any error).
Repeat the same steps, but just switch on the tracer at the time of sending the email.
1. Activity – SendSimpleEmail which is responsible for sending out the email.
The SendSimpleEmail activity accepts an important parameter called batchsend = true/false.
The activity step saves the correspondence instance into database table if a the email to be send via batch mode

2. Data-Corr-Email class instance – This is where Pega saves the corr email instance
Here you can also find all the email content attached to this instance

3. Standard Agent – SendCorr, which takes care of background processing to send out the email

Make sure this OOTB agent is running from your admin studio 😊
That ends this blog article!



