How to stop Inbound mails creating a case for Email Delivery Failure Notifications?

Hi,

I have a gmail mailbox setup as Inbound Group Mailbox in Sugar , its setup to create Cases automatically. I have a problem of cases being created for bounced back emails such as the Email Delivery Failure notification emails, which we don't want to, does anyone have any suggestions/ answers based on a similar experience? Please let me know.

Note: The SMTP used for outgoing emails from sugar uses Amazon SES(Simple Email Service) 

Regards,
Vijay

Parents
  • We had a similar situation and we had to modify the code to achieve this, which is non upgrade safe - so this can be done only in a on-premise installation. There are several ways to do this via code, but we choose a simple approach instead.

    Keep a list of standard subject templates that the email starts with. These can be preg patterns and can be stored in config to ensure they can be added/modified as needed:

    Eg:

    $sugar_config['email_subjects_to_skip'] =
    [
    "^Mail delivery failed",
    "^Delivery Status Notification",
    "^Out of Office",
    ];

    Then in InboundEmail.php - handleAutoResponse (or handleCreateCase if you also want to stop creating cases for such emails), you can add a simple check that checks if the subject starts with one of these (don't check if the subject contains the string - because that could be a real reply or forward), and if it matches, just stop processing them and add helpful logs.

    foreach($emailSubjectsToSkip as $skip) {
    if(preg_match("/$skip/i", $subject)) {
    $GLOBALS['log']->debug("Email with Subject $subject skipped...");
    return false;
    }
    }
Reply
  • We had a similar situation and we had to modify the code to achieve this, which is non upgrade safe - so this can be done only in a on-premise installation. There are several ways to do this via code, but we choose a simple approach instead.

    Keep a list of standard subject templates that the email starts with. These can be preg patterns and can be stored in config to ensure they can be added/modified as needed:

    Eg:

    $sugar_config['email_subjects_to_skip'] =
    [
    "^Mail delivery failed",
    "^Delivery Status Notification",
    "^Out of Office",
    ];

    Then in InboundEmail.php - handleAutoResponse (or handleCreateCase if you also want to stop creating cases for such emails), you can add a simple check that checks if the subject starts with one of these (don't check if the subject contains the string - because that could be a real reply or forward), and if it matches, just stop processing them and add helpful logs.

    foreach($emailSubjectsToSkip as $skip) {
    if(preg_match("/$skip/i", $subject)) {
    $GLOBALS['log']->debug("Email with Subject $subject skipped...");
    return false;
    }
    }
Children
No Data