# Sanitize email body of received emails

**URL:** <https://forums.pega.com/t/sanitize-email-body-of-received-emails/8976>\
**Category:** General\
**Tags:** 24-1-1, email, 24-1, financial-services, pega-platform, lead-system-architect\
**Created:** [February 7, 2025, 12:47pm UTC](https://forums.pega.com/t/sanitize-email-body-of-received-emails/8976 "2025-02-07T12:47:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AleMax225](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/alemax225/32/23320_2.png) [@AleMax225](https://forums.pega.com/u/AleMax225)\
**Post date:** [February 7, 2025, 12:47pm UTC](https://forums.pega.com/t/sanitize-email-body-of-received-emails/8976/1 "2025-02-07T12:47:57Z")

</div>

We have the need to remove a custom message (injected by our firewall) from all the emails received from our customers.

Right now the only way we have are exploiting the extension point:

**_Work-Channel-Triage-Email.MapEmailToEmailTriageExtn_**

and we had to change the _Email Service \> Request \> Message data \> Handle HTML_ Content from “As HTML attachment” to “Inline - Prefer HTML”, which is now giving us a some troubles, because some of the emails are NOT correctly detected as HTML!

Is there another extension point that we can keep the old configuration “As HTML attachment” and change the email body?

With this setting we have noticed that if we replace the text in the previous extension point, then the body is sourced from the attachment, instead of the one in the property.

---

<div class="post-metadata">

**Author:** ![MarijeSchillern](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/marijeschillern/32/23321_2.png) [@MarijeSchillern](https://forums.pega.com/u/MarijeSchillern)\
**Post date:** [February 27, 2025, 12:42pm UTC](https://forums.pega.com/t/sanitize-email-body-of-received-emails/8976/2 "2025-02-27T12:42:09Z")

</div>

@AleMax225 ⚠ This is a GenAI-powered tool. All generated answers require validation against the provided references.

After researching alternative extension points for your specific situation, I have several approaches that might help solve your issue while allowing you to keep the “As HTML attachment” configuration.

## **Alternative Extension Points**

The `Work-Channel-Triage-Email.ProcessEmailInformation` extension point could be a viable alternative to the `MapEmailToEmailTriageExtn` you’re currently using. This data transform is executed after the initial extraction of email content but before the email is fully triaged and routed, making it suitable for sanitizing operations.

The key difference is in its timing in the processing flow:

- It’s called earlier in the processing sequence
- It’s specifically designed for mapping extracted information for further case processing
- You could implement sanitization logic within this data transform to filter out the firewall-injected message

## **Handling HTML Attachments**

When using the “As HTML attachment” setting, the email HTML content is stored as an attachment. While there isn’t a documented extension point specifically for modifying HTML attachments after creation, you do have options:

1. **Custom Activity Approach** : You could create a custom activity that:
  - Executes after the HTML attachment is created
  - Retrieves the attachment content
  - Removes the firewall message
  - Updates the attachment with the sanitized content
  - This activity can be called from the flow that processes the email

2. **Case Attachment Extension Points** : Pega provides extension points for customizing how attachments are processed when added to a case. You might be able to leverage these to intercept and modify the HTML attachment during case creation.

## **The “Property vs. Attachment” Challenge**

I noted your observation about how “the body is sourced from the attachment, instead of the one in the property” when using “As HTML attachment.” This is expected behavior since this setting is designed to store the HTML in an attachment rather than directly in a property.

To address this specific challenge, you might consider:

1. First processing the attachment to remove the firewall message
2. Then copying the sanitized content to the appropriate property if needed for display or further processing

## **Next Steps**

I would recommend trying the `Work-Channel-Triage-Email.ProcessEmailInformation` extension point first, as it might allow you to intercept and sanitize the email content before it becomes an attachment. If that doesn’t solve the issue, the custom activity approach targeting the HTML attachment directly would be my next suggestion.

---

<div class="post-metadata">

**Author:** ![AleMax225](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/alemax225/32/23320_2.png) [@AleMax225](https://forums.pega.com/u/AleMax225)\
**Post date:** [February 27, 2025, 1:32pm UTC](https://forums.pega.com/t/sanitize-email-body-of-received-emails/8976/3 "2025-02-27T13:32:39Z")

</div>

@MarijeSchillern the `Work-Channel-Triage-Email.ProcessEmailInformation` extension point does not exists

---

<div class="post-metadata">

**Author:** ![MarijeSchillern](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/marijeschillern/32/23321_2.png) [@MarijeSchillern](https://forums.pega.com/u/MarijeSchillern)\
**Post date:** [February 27, 2025, 1:38pm UTC](https://forums.pega.com/t/sanitize-email-body-of-received-emails/8976/4 "2025-02-27T13:38:16Z")

</div>

@AleMax225 apologies for that. My answer came from a GenAI source, and it had incorrectly included documentation from a the Smart Investigate Agentic Automation '24.2 product

[Extension points](https://docs.pega.com/bundle/smart-investigate-agentic-automation/page/smart-investigate-agentic-automation/implementation-constellation/extension-points.html)

I want to note that while there is documentation on the email processing flow and HTML handling options, I did not find explicit documentation for the MapEmailToEmailTriageExtn extension point specifically.

If you need to read around the subject, below some documentation:

### **Extension Points for Email Processing**

- [Email triage process](https://docs.pega.com/bundle/platform-241/page/platform/conversational-channels/email-triage-process.html) - Information about the overall email triage flow and processing
- [Extension points](https://docs.pega.com/bundle/smart-investigate-agentic-automation/page/smart-investigate-agentic-automation/implementation-constellation/extension-points.html) - Contains information about the S.I. product ProcessEmailInformation extension point and its purpose in mapping information extracted from inbound emails

### **HTML Attachment vs. Inline HTML Handling**

- [Troubleshooting email listeners](https://docs.pega.com/bundle/platform-241/page/platform/data-integration/troubleshooting-email-listeners.html) - Information about the “Inline - prefer HTML” setting and ensuring email messages retain text formatting
- [Enabling inline images in email triage cases](https://docs.pega.com/bundle/deployment-manager/page/platform/conversational-channels/enabling-inline-images-triage-cases.html) - Details about configuring email body as HTML attachments

### **Community Discussions and Support Articles**

- [How to Inbound Email, Embedded attachments Display in Review Screen](https://support.pega.com/discussion/how-inbound-email-embedded-attachments-display-review-screen) - Discussion about HTML content handling in email bodies
- [Formatting Email Body without HTML Rule](https://support.pega.com/discussion/formatting-email-body-without-html-rule) - Information about email body formatting and security considerations like cross-site scripting protection

---

<div class="post-metadata">

**Author:** ![AleMax225](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/alemax225/32/23320_2.png) [@AleMax225](https://forums.pega.com/u/AleMax225)\
**Post date:** [August 7, 2025, 6:59am UTC](https://forums.pega.com/t/sanitize-email-body-of-received-emails/8976/5 "2025-08-07T06:59:35Z")

</div>

@AleMax225 At the end we have solved the problem by exploiting the customizable data flow pyInteractionDF of our email channel by following this documentation: [Interaction API components](https://docs.pega.com/bundle/platform/page/platform/decision-management/interaction-api-components.html)
