Is there a way we can parse and get the value of "X-Original-From" from the header of an email which got forwarded/redirected to Servicenow

Sn22
Kilo Contributor

HI All, 

 Our instance has too many forwarded/redirected emails coming in and we want to fetch the "X-Original-From" from the header, is there a way to do that via scripts ?. email.origemail does not give the right sender address hence we want to do it manually.  

 

 

 

 

 

@Ankur Bawiskar @Chuck Tomasi 

5 REPLIES 5

VigneshMC
Mega Sage

Did you try using "email.origemail" ?

Read more here:

https://community.servicenow.com/community?id=community_blog&sys_id=8fecae65dbd0dbc01dcaf3231f9619d3

https://docs.servicenow.com/bundle/helsinki-servicenow-platform/page/administer/notification/reference/r_AccessingEmailObjsWithVars.html

Thanks

Sn22
Kilo Contributor

Hi Vignesh, 

 yes i have tried it, but "email.origemail" also does not give us the right email sender as it goes through 2-3 redirections. 

Try this

var str= email.headers;
var mySubString = str.substring(
    str.lastIndexOf("X-Original-Sender:") + 18, 
    str.lastIndexOf("X-Original-Authentication")
);
gs.log("from inbound " +mySubString);

It worked for me but why u used +18 ,didnt understand