TIP#3 – Sending Cc and Bcc Emails using SendSimpleEmail OOTB activity

There can be ‘N’ number of ways to look at a problem and equally number of ways to solve but we provide the best tip to minimize your debugging efforts to solve it faster.

Pega provides many OOTB activities/utilities for sending Email notifications from system. Some of them are listed below:

  1. SendSimpleEmail
  2. CorrNew
  3. SendEmailNotification
  4. pzSendEmail (used by Send Email shape in flow)… many more

Each activity is provided by Pega due to different reasons and to achieve different purposes. Prerequisite for using any of the above utilities is Email Account (default or class group specific) should be configured prior to sending Emails notifications.

SendSimpleEmail is one of the most widely used activities to send email notifications because of its user friendly parameters and especially when Emails are to be triggered from multiple places in the application. Below are the Parameters that it accepts:

There is a drawback that we can’t send Cc and Bcc emails by using SendSimpleEmail activity and we noticed that many are asking for the same in Pega community. This article explains how to:

  1. Send Cc Emails by using SendSimpleEmail activity
  2. Send Bcc Emails by using SendSimpleEmail activity
  3. Stop sending Emails(when required) from the application when SendSimpleEmail activity is used everywhere in the application

By following Pega best practices

Prerequisite / Assumption: Considering Email Account (Default/Class Group) is configured.

Step-1: Create a new activity SendSimpleEmail_Custom in your application in the required class and define the same parameters as OOTB SendSimpleEmail activity, additionally define 2 more parameters Cc and Bcc as shown below

Step-2: Call SendSimpleEmail activity from this activity by passing the current parameter page as shown below

Step-3: Start using the newly created SendSimpleEmail_Custom activity in your application in place of SendSimpleEmail activity wherever needed

Step-4: Ensure to pass Cc and Bcc parameters with comma separated Email IDs’ while calling SendSimpleEmail_Custom activity

Step-5: Save As and update the pyDefault data transform in Data-Corr-Email class by adding below highlighted steps to set pyCCString and pyBCCString properties

That’s it… this way you can easily start sending the Cc and Bcc emails by using the OOTB SendSimpleEmail activity.

Also, to stop sending the emails use a pre-condition in the SendSimpleEmail_Custom activity to exit when a DSS value is false so that the emails will only be sent when the DSS contains a specific value like “true”

Hope this helps, all the best !