Logo
  • Products
    • SecOps Studio
  • Solutions
    • Pega Stack Shifter
  • Services
    • Pega Enablement
    • Pega Modernization
  • About
  • Contact
  • Blog
Code Vault

Service Email Usage – Handle DSN

December 10, 2024 Code Vault Curators

In this final installment of our series, we will explore how to manage Delivery Status Notification (DSN) messages within Pega.

Note: This article was developed using Pega 7.4. While specific configurations may vary in newer versions, the fundamental concepts remain applicable.

Series Roadmap

To fully grasp the progression of Pega email integration, consider reviewing the articles in this order:

  1. Case Creation: Generate a case from an incoming email.
  2. Email Approvals: Automate case updates using Subject line data to identify the Case ID. (Current Post)
  3. Conversation Management: Use Message-ID headers to link replies to cases.
  4. DSN Handling: Manage delivery failures using the Thread-Topic field.

What is a DSN Message?

A Delivery Status Notification is an automated response sent by email providers for two primary reasons:

  • Bounced Emails: The message failed to reach the recipient (e.g., mailbox is full, invalid address).
  • Auto-replies: The recipient is out of the office or on vacation.

Note: For auto-replies, Pega typically expects the term “Autoreply” within the message. If this specific term is missing, there is a risk the message may not be identified correctly.


How to Handle DSN Messages

The primary configuration point is within the Email Listener rule form.

Step 1: Open the Email Listener and navigate to the Process tab.

If the Process Delivery Status Notifications option is unchecked, these messages will be discarded.

Let’s test this behavior:

Enjoying this content?

Access the author’s full video courses here at MyKnowAcademy.

Explore Courses →
Author

I trace the service email rule and run the case.

In a service case “send mail” step, I input an intentionally incorrect email address.

With the setting unchecked, nothing appears on the tracer, and no processing occurs. The DSN message is left unhandled.

Why Handling DSNs Matters

Imagine a bank using Pega to service customers. If Pega sends a “late payment” email to a customer who has deleted their account, the email will continue to bounce. To handle this effectively, Pega should update the case details or notify the case owner so they can take alternative action.

Learning Pega’s Custom Email Headers

Pega sends three vital custom headers in every outbound email. You can see these in the Agent activity: Send (Class: Data-Corr-Email).

1. X-PegaWork-Handle – Contains the case pzInsKey

2. X-PegaEmail-Handle – Contains the Data-Corr-Email pzInsKey

3. Thread-Topic: A concatenation of the Case Key, Corr Key, and the Subject.

Processing the DSN Messages

Step 1: Enable DSN Processing

Switch on “Process Delivery Status Notifications” in the Email Listener rule.

Note: Always restart the listener after making changes for them to take effect.

Step 2: Map DSN Details in the Service Rule

In the Service Email rule, navigate to the Request tab. There is a specific block dedicated to DSN mapping.

Key fields available for mapping include:

  • Reporting-MTA: The server reporting the DSN.
  • Action: The action performed by the server (e.g., failed).
  • Status: The DSN status code.
  • Original…: Fields starting with “original” contain the original message information.

Pega also provides a Rule-Utility-Function to parse the Thread-Topic back into its four component fields.

Important: You must specify the Thread-Topic in the email header block of your Request tab for this mapping to function.

Testing the DSN Parsing

If you trace the rule and send mail to a junk address, you might notice the Thread-Topic data is missing.

Why is this happening? If you inspect the raw email data, you will see that some providers (like Gmail) do not include our custom headers in the DSN message itself.

If you scroll to the end of the raw data, you will see Pega correctly set the headers in the original email, but the DSN provider stripped them.

How to solve this? Refer back to Use Case 3. You can always use the Message-ID and In-Reply-To headers to identify the original email and the corresponding case. Even if headers are stripped, the DSN Status and Action values usually remain correctly mapped.

Summary of this Use Case

  • DSN messages help you identify if an outbound message failed.
  • Utilize the DSN block in the email request tab to collect all available failure data.
  • Identify the affected case using the Subject ID (Use Case 2), Message-ID (Use Case 3), or Thread-Topic.
  • Build your custom service activity to handle these failures (e.g., notifying a manager).

Important Safety Note: When creating cases via email, always either discard DSN messages or handle them very carefully. Failure to do so can result in an infinite looping scenario!

This concludes our series on Pega Email Servicing. Explore your email headers and make use of these features to build a more robust integration!

  • email-processing
Code Vault Curators

A technical team dedicated to empowering the Pega ecosystem with in-depth knowledge, guided by Premkumar Ganesan's vision.

Post navigation

Previous
Next

Pega Courses

Pega courses can be accessed at https://myknowacademy.com

Search through the blog

Tags

activity authentication background-processing case-management data-model declarative-processing email-processing file-processing pega-core-concepts pega-integration process reporting security system-administration user-interface validation

Categories

  • Career
  • Code Vault
  • Insight

Recent posts

  • Career Advice for Pega Developers – Upskilling in 2026
  • Standard Queue Processing Vs Dedicated Queue Processing in Pega
  • Pega LSA Exam Format is changing again with Infinity ’25
  • Pega Blueprint: Top 10 Features That Shaped Its Evolution
  • Different Applications in Pega: Components, Component Applications and Modules

Related Articles

Code Vault

Sending Outbound Emails from Pega

March 2, 2026 Editorial Team

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 […]

Code Vault

Service Email Usage – Manage Conversations

December 10, 2024 Code Vault Curators

In this blog article, we will explore our third use case: Managing Email Conversations within Pega using Service Email Note: This article was created using Pega 7.4. While configurations may differ in more recent versions, the core concepts remain the same. Series Recap To get the most out of this series, I recommend visiting these […]

Code Vault

Service Email Usage – Approval Flow

December 10, 2024 Code Vault Curators

This second article in our series focuses on a powerful automation feature: Email Approvals. We will explore how to notify users of a pending approval via email and, more importantly, how Pega processes their “Approve” or “Reject” reply to move the case forward automatically using the same Service Email rule. As a recap, we are […]

Code Vault

Service Email Usage – Case Creation

December 10, 2024 Code Vault Curators

In the previous articles, we explored how to create a file listener, an email account, and a service email using the Email Wizard and this article we will create a new case using Service Email The fundamental processing logic for all listeners in Pega is consistent: the listener monitors a specific location for a message, […]

About

MyKnowTech was born with a mission to bridge the gap between technical expertise and business needs. We are a boutique firm specializing in Pega solutions, delivering them with a personal touch. At the heart of our philosophy is a commitment to putting clients first.

Company
  • About
  • Leadership
  • Career
  • Contact
Resources
  • Blog
  • Services
  • Solutions
  • Insights

©  MyKnowTech B.V. All Rights Reserved.

  • Sitemap
  • Terms & Conditions
  • Privacy Policy