Copied is empty when the recieve type if forward

Prasun Sarkar7
Tera Expert

We have a shared mailbox configured in our project which auto forwards the email to our dev instance. So when the emails are getting forwarded the copied "cc" are coming as empty as we have a requirement to get the cc users in watch list. What can be the workaround else need to develop an action to process the cc emails from headers.

PrasunSarkar7_2-1769184069949.png

 

1 REPLY 1

Itallo Brandão
Tera Guru

Hi @Prasun Sarkar7 ,


This is actually expected behavior when using standard "Auto-Forwarding" rules in email systems (like Exchange or Office 365).

The Root Cause: When a mail server Forwards an email, it technically creates a new email envelope.

  • Sender: Becomes the Shared Mailbox.

  • To: Becomes your ServiceNow instance email.

  • CC: Is usually wiped out because the Shared Mailbox is not "CCing" anyone on this new message to ServiceNow.

The original CCs are lost from the SMTP headers, which is why the copied field in ServiceNow is empty.

Solution 1: Switch to "Redirect" (Recommended - No Code)

The cleanest fix involves changing the configuration on your Mail Server (Exchange/O365), not in ServiceNow.

Ask your Exchange/Email Administrator to change the inbox rule from "Forward" to "Redirect".

  • Forward: Creates a new email (breaks headers).

  • Redirect: Passes the original email along exactly as it was received. It preserves the original Sender, To, and CC headers.

If you use Redirect, ServiceNow will see the email exactly as if the original user sent it directly to the instance, and the copied field will auto-populate.

Solution 2: Parsing the Body (If Redirect is impossible)

If your security policy does not allow "Redirect", the original CCs are likely sitting inside the Body of the email (in the text block that says From: ..., Sent: ..., To: ..., Cc: ...).

You will need to write a script in your Inbound Action to extract them using Regex.

Example Script Logic:

 
// Example logic for Inbound Action
// 1. Find the CC line in the body text using Regex
var bodyText = email.body_text;
var ccLine = /Cc:\s*(.+)/i.exec(bodyText);

if (ccLine && ccLine[1]) {
    var ccEmails = ccLine[1].split(/[;,]/); // Split by comma or semicolon to get individual emails

    // 2. Loop through emails and add to Watch List
    for (var i = 0; i < ccEmails.length; i++) {
        var emailAddr = ccEmails[i].trim();
        // Add your logic here to find the User SysID based on emailAddr
        // and add to current.watch_list
    }
}

Summary: Try Solution 1 (Redirect) first. It solves the root cause instantly without any custom coding or parsing issues.

If this response helps you solve the issue, please mark it as Accepted Solution.

Best regards,
Brandão.