The difference between Inbound Email Action variables email.from & email.origemail
An inbound email action script has access to various pieces of an inbound email through script variables. The script variables email.from and email.origemail can be different.
email.from
email.from contains an email address according to the following conditions. If the address listed in the email Headers field matches an existing user's Email address, this variable contains the user's Email address. If the address listed in the email Headers field does not match an existing user's Email address, this variable contains the address listed in the email Headers field (starting with Eureka Patch 5) or the Guest user's Email address (in versions prior to Eureka Patch 5).
email.origemail
Now, email.origemail contains the email sender's address as listed in the email Headers.
Here is an example to show the difference between email.from and email.origemail
I've created an inbound email action 'Create Incident - JS', Type=New
The script is:
gs.log("-email.origemail: " + email.origemail + " -email.from: " + email.from + " - - JS");
current.caller_id = gs.getUserID();
current.comments = "-email.origemail: " + email.origemail + " -email.from: " + email.from + "\n\n" + email.body_text;
current.short_description = email.subject;
current.insert();
Then I've created a user with
-userid=test.user@abc.com, email=test3.user@abc.com
NOTE the (number "3" on the email).
Then with the user test.user@abc.com, you sent the email to the instance. Once the email is recieved, you will notice the headers contain > From:Test.User@abc.com.
Now, on the logs and incident comment created, you will see:
-email.origemail: Test.User@abc.com-email.from: test3.user@abc.com
More information here:
https://www.servicenow.com/community/developer-blog/the-difference-between-inbound-email-action-variables-email-from/ba-p/2275536