How to Block Automatic Reply Emails from Processing in ServiceNow

RohitDhiman
Tera Contributor

Hi everyone,

We have some generic email addresses set up by a customer. Every time we update a case or send them an email, we receive an automatic reply from their side. This prevents us from marking the case as resolved, as it reopens due to the lack of an actual response.

I want to block these emails from being processed.

I tried using an inbound email action with the following script but it didn’t work as expected:

 

 
var sender = email.from.toLowerCase();
// Define blocked addresses
var blockedAddresses = [
    "blocked1@domain.com",
];
// Check if sender is in blockedAddresses
if (blockedAddresses.indexOf(sender) !== -1) {
    gs.info("[Inbound Email Action] Blocked email received from: " + sender + ". Skipping processing.");
   
    // Abort further processing of this inbound email action
    action.setAbortAction(true);
}


Could someone please guide me on how to effectively block or ignore these automatic reply emails in ServiceNow?

Thank you in advance for your help.

9 REPLIES 9

dbook
Kilo Sage

I would use an Inbound email flow over an action as the more mordern way to configure this kind of requirement. 

 

Creating Inbound Email Flows 

 

Setting the filter conditions should be relative straight forward. 

 

As a side note, Inbound Email flows are processed ahead of Inbound actions so will take precedence.  

 

dbook_0-1752067947663.png

 

Thank you @dbook for your advice.
I haven’t tested it with the Inbound Email flow yet but will share the results once done.

Regards,
Rohit Dhiman

Pranesh072
Mega Sage
Mega Sage

Change the order to 0 or lowest and enable the stop processing field.

Thank you @Pranesh072 for your suggestion.

I hadn’t enabled the Stop Processing field earlier, but after enabling it, the same script worked as expected.
Could you please confirm if enabling this field will have any impact on other Email Inbound Actions?

Regards,
Rohit Dhiman