Check BCC field on incoming email?

adaml
Mega Expert

I am looking to create an Incidnet for any incoming email that is received in our SN instance that is addressed (either via TO, CC or BCC) to a specific email address (abc@xyz.com). We have about 5 total incoming email mailboxes hooked up to intake emails into SN.

Currently, the conditions on the Incoming Email Action is as such ((email.to.toString().toLowerCase().indexOf("abc@xyz.com") >-1) which matches when the TO or CC fields have the address in it.

What I cannot figure out how to do is to ALSO execute the Inbound Email Action when the BCC has this email address as well.

I tried outputting the Header (email.headers) to the log to see if it contains any trace of the bcc address, but it does not.

Is there anyway to determine the BCC address on a received email like this?

1 ACCEPTED SOLUTION

adaml
Mega Expert

Actually, I take it back, I was able to find it by looking in the header info. I used the following:



(email.headers.toString().toLowerCase().indexOf("for <abc@xyz.com>")


View solution in original post

3 REPLIES 3

samiul1
Tera Expert

Have you tried using "email.recipients" variable?
http://wiki.servicenow.com/?title=Inbound_Email_Actions#Accessing_Email_Objects_with_Variables



You can setup your condition, if "email.recipients" contains your desired address, then process your inbound action


HI Samiul, yes - I also pushed the email.recipients values to the log to check whether or not the BCC address showed up in there, and it does not. I still can't seem to find any practical way to detect the bcc address anywhere in an incoming email.


adaml
Mega Expert

Actually, I take it back, I was able to find it by looking in the header info. I used the following:



(email.headers.toString().toLowerCase().indexOf("for <abc@xyz.com>")