I have to allow more than one email address those can send emails to ServiceNow instance.

niveditakumari
Mega Sage

Hi, 

 

I have to allow more than one email address those can send emails to ServiceNow instance. 

I'm working on inbound action and I want to allow multiple domains hat can send emails to my ServiceNow instance and I want to create multiple email account for my ServiceNow instance. 

Can anyone please tell me how we can achieve. 

 

Regards, 

Nivedita

 

 

1 ACCEPTED SOLUTION

niveditakumari
Mega Sage

Hi All, 

 

We can achieve it by using email address filter. 

1. Create Email Address filter and add that domain name in domains field that you want to allow

and add domain name in exceptions which you don't want to allow. 

2. Create System Address filter and add this Email Address filter in that. 

3. Open POP3 Email Account and add System Address filter in that. 

Please see screenshot to achieve it : 

find_real_file.png 

 

Hope this helps to everyone. 

 

 

Regards, 

Nivedita

 

 

View solution in original post

34 REPLIES 34

 

I'm calling sys property here. 

When I'm removing any email address from sys property value then also I'm able to receive emails from that email address. 

It should not receive email from that email address. 

Can you please correct me. 

 

Regards, 

Nivedita

 

 

Change line 4 to

var donotaccept=gs.getProperty('allow_domains')

if(email.origemail.indexOf(donotaccept)>-1){

//allow code here

}

else

{

//do not allow code

}

(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {

 

var donotaccept=gs.getProperty('allow_domains'); 
if(email.origemail.indexOf(donotaccept)>-1){

current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject; 
current.rich_description = email.body_text; 
current.opened_by = gs.getUserName(); 
current.subject_person = gs.getUserName(); 
current.opened_for = gs.getUserName(); 
current.hr_service = '6628cde49f331200d9011977677fcf0b'; 

current.notify = 2;
current.contact_type = "email";

if (email.body.assign != undefined)
   current.assigned_to = email.body.assign;

if (email.importance != undefined) {
   if (email.importance.toLowerCase() == "high") {
        current.impact = 1;
        current.urgency = 1;
   }

current.insert();

}

else

{

gs.info('not allowed');

}


})(current, event, email, logger, classifier); 

 

 

I'm using this still I'm able to get emails from this email address. 

Can you please correct it. 

 

Regards, 

Nivedita

 

 

Because the if clause is satisfied. You need the logic in else part instead of if part of script.

 

(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {

 

var donotaccept=gs.getProperty('allow_domains'); 
if(email.origemail.indexOf(donotaccept)>-1){

current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject; 
current.rich_description = email.body_text; 
current.opened_by = gs.getUserName(); 
current.subject_person = gs.getUserName(); 
current.opened_for = gs.getUserName(); 
current.hr_service = '6628cde49f331200d9011977677fcf0b'; 

current.notify = 2;
current.contact_type = "email";

if (email.body.assign != undefined)
   current.assigned_to = email.body.assign;

if (email.importance != undefined) {
   if (email.importance.toLowerCase() == "high") {
        current.impact = 1;
        current.urgency = 1;
   }

current.insert();

}

else

{

gs.info('not allowed');

}


})(current, event, email, logger, classifier); 

 

I have put this in else part and according to me it is correct. 

Please correct my code to achieve it. 

 

Regards, 

Nivedita