Email related issue

Anusha Medharam
Tera Contributor

When customer send case though email if the customer send email allow domains that time only case is created otherwise case is not created and send notification to customer this is un authorized domain.

3 REPLIES 3

SumanthDosapati
Mega Sage
Mega Sage

Hi @Anusha Medharam 

 

Your question is not clear.

Check if this is what you are looking for.

 

Regards,

Sumanth

Robbie
Kilo Patron
Kilo Patron

Hi @Anusha Medharam,

 

I’m a little unclear as to what you’re trying to do but If I understand your question correctly, you want to restrict which domains you can receive emails from (which subsequently create a case record), and based on any untrusted domains, reply to these emails to advise accordingly.

 

There’s a handy link and demo below, but basically you want to look at email address filters where you can control which emails domains are permitted or not permitted.

You’d then want to trigger an event to respond to said non permitted emails (However I’d like to understand the metrics around this use case and at a high level understand whether you truly want to respond to emails/users/domains which are untrusted/not allowed especially if you are  a public facing service)

 

Emails filters – SN Link:

https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/administer/notification/task/set-e...

 

Demo and handy link:

https://www.servicenow.com/community/developer-articles/servicenow-email-filter-introduction-to-serv...

 

To help others, please mark this as correct and helpful.

 

Robbie

SunilKumar_P
Giga Sage

Hi @Anusha Medharam, Can you try something like below?

 

if (email.from.indexOf("@yourcompany.com") > -1) // This captures the sender's email address and check if it was sent from an internal email address
{
    //This will fire an event that will create an email notification for auto-reply. You will need to register this event.. and associate this with an email notification
    gs.eventQueue("incident.autoreply", current, gs.getUserID(), gs.getUserName());
}
//If you 'd like to prevent a record to be created, you will have to modify the "current.insert()" or "current.update()" part of the script. The new script will look something like:
if (email.from.indexOf("@yourcompany.com") > -1) {
    //If the email was sent from an internal email address, fire an event for email notification
    gs.eventQueue("incident.autoreply", current, gs.getUserID(), gs.getUserName());
} else {
    //If the email wasn't from an internal email address, insert the record
    current.insert()
}

 

Regards,

Sunil