Inbound email action - call script include in condition

adam_webster
Kilo Contributor

Hi,

Im not able to include multiple email addresses in the condition field for the inbound email action script due to length.

I need some guidance on creating a script include and calling it in the inbound action condition.

script include:

function checkEmail(email) {
var e1 = email.receipients.toLowerCase().indexOf('****') >= 0;
var e2 = email.receipients.toLowerCase().indexOf('******') >= 0;
var e3 = email.receipients.toLowerCase().indexOf('*******') >= 0;
var e4 = email.receipients.toLowerCase().indexOf('*******') >= 0;
var e5 = email.receipients.toLowerCase().indexOf('**********') >= 0;


return e1 || e2 || e3 || e4 || e5;
}

Thanks,

 

A

7 REPLIES 7

SanjivMeher
Kilo Patron
Kilo Patron

You could have done it in the inbound script itself

 

var rec = email.receipients.toLowerCase();

 

if (rec.indexOf('****')>-1 || rec.indexOf('******')>-1 || rec.indexOf('*******')>-1 || rec.indexOf('*******')>-1 || rec.indexOf('**********')>-1)

{

Your inbound script

}

 

if you want to do it in script include

 

checkEmail: function(email) {
var e1 = email.receipients.toLowerCase().indexOf('****');
var e2 = email.receipients.toLowerCase().indexOf('******');
var e3 = email.receipients.toLowerCase().indexOf('*******');
var e4 = email.receipients.toLowerCase().indexOf('*******');
var e5 = email.receipients.toLowerCase().indexOf('**********');

if (e1>-1 || e2>-1 || e3> -1 || e4>-1 || e5>-1)
return 'return true or false as required';
}


Please mark this response as correct or helpful if it assisted you with your question.

adam_webster
Kilo Contributor

Thanks for your assistance. I tried what you suggested to include the if statement in the inbound script but the inbound action get skipped.

 

thanks,

 

A

Ujjawal Vishnoi
Mega Sage
Mega Sage

Hi Adam,

 

There is a typo in your script. You need to replace email.receipients with email.recipents.

 

Hope this helps.

 

Regards

Ujjawal

adam_webster
Kilo Contributor

Thanks for spoting that typo.

 

Not sure what im doing wrong as the inbound action is still getting skipped.

Any Ideas?

 

Thanks,

 

A