function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nikhil Shringarpure 22Nikhil Shringarpure 22 

What is the Best way to handle email war or infinite loop which creates a large number of cases, caused due to Automatic Reply or Auto Response or Out of Office replies in Email to Case

What is the Best way to handle email war or infinite loop which creates a large number of cases, caused due to Automatic Reply or Auto Response or Out of Office replies in Email to Case?

Couple of ways i explored that might work.

1: Write a Trigger before insert for the case , here you check if the subject has key words like automatic reply or OOR and if found then do not create a case for such emails. This will avoid any new cases being created after the 1st one, no email will be sent back to the sender as no new case was created and this will stop the loop.
Cons: If the email comes with keyword other than the ones you are checking in the subject then it might not work, will have to try to capture all such keywords to stop it from creating more cases.

2: I read some blogs where people suggested to write a tigger which will check if more than 3 emails are received from the same email id with the same subject in a short duration of time if found then kill the loop and not create more cases.
Cons: I see that the biggest drawback here is that it will still create a 3 cases before it decides that this is a auto reply email frenzy.
2nd con i see is that sometime due to various network/organisation/outlook problems the auto reply email might not be received immd and this might make the system beleive that its a valid response and create a new case.

3: We currently do not have the Thread id or the case id on the subject on the template that we use to send emails back to customer for cases created , will adding the thread id on the subject link it in a way that when an auto reply email is received it knows that its the same thread id and not create an addional case. We do have a thread and case id in the body of the email. 

Does anybody have the most efficient way to handle this common problem?
sushant sussushant sus
Hi ,

I also faced same issue , main issue i faced when case created through email services  and automatic response mail got  bounce back again and  again which lead to creation of lot of cases because salesforce tries to send mail multiple times in a day .
    we solve this issue by adding case id in email subject and checking subject text in before insert  trigger .

If its helps please like :)
VineetKumarVineetKumar
Few measures you can take.
  • If your network team, how setuped the email forwarding for your inbox can setup some spamming rule or some rules to block out messages falling under some criteria
  • Apex Trigger code that makes a check for such spam email and discards it without letting it save in the database.
  • If you include CaseEmail thread in your email template, it might automatically come under the parent case, instead of creating new cases, which i suppose is happening at present.
Let me know if it helps.