How to check recipients in Inbound Email Actions

The Matrix
Tera Contributor

Hi All,

I have tasked to create a specific type of case when Email is sent to specific email id. I have tried below code but its is not working for me. How do I check recipients email id in Inbound Script

if(email.from.indexOf("police.request@example.com"){
current.case_type = "police_request"
current,state = "10";
current.short_description = email.subject;
current.description = email.body_test;
current.insert();
}

 

1 ACCEPTED SOLUTION

Sumanth16
Kilo Patron

Hi @The Matrix .

 

Try below code:

if (email.direct.toLowerCase().indexOf('email@domain.com')>-1) 

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

View solution in original post

2 REPLIES 2

Neeraj31
Mega Sage

Hi @The Matrix ,

Try below code

 

if(email.from.indexOf("police.request@example.com" != -1){
current.case_type = "police_request"
current.state = "10";
current.short_description = email.subject;
current.description = email.body_test;
current.insert();
}

 

Also there is a typo (comma) in your code.

current,state = "10";

Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Sumanth16
Kilo Patron

Hi @The Matrix .

 

Try below code:

if (email.direct.toLowerCase().indexOf('email@domain.com')>-1) 

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda