changing the "From" in email notification

Mag_ Tomer Harp
Tera Expert

Hello,

I would like to set the "From" field in email notification so using script, I will be able to decide who will see what in the "From" field while sending an email (outbound).

Thx

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hi @Mag. Tomer Harpaz 

You can add the "From" field to your notification form layout (configure > form layout), if it's not already there. Then you can set it as you'd like.

For scripting, you can create a mail script and use something like:

email.setFrom("fakeemail@example.com");

or

email.setFrom("Fake IT HelpDesk <fakeIThelpdesk@example.com>");

Then, to call the mail script, you can use: ${mail_script:name_of_mail_script} in the body of the notification.

Please mark reply as Helpful/Correct, if applicable. Thanks!


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

View solution in original post

4 REPLIES 4

Allen Andreas
Administrator
Administrator

Hi @Mag. Tomer Harpaz 

You can add the "From" field to your notification form layout (configure > form layout), if it's not already there. Then you can set it as you'd like.

For scripting, you can create a mail script and use something like:

email.setFrom("fakeemail@example.com");

or

email.setFrom("Fake IT HelpDesk <fakeIThelpdesk@example.com>");

Then, to call the mail script, you can use: ${mail_script:name_of_mail_script} in the body of the notification.

Please mark reply as Helpful/Correct, if applicable. Thanks!


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

palanikumar
Giga Sage
Giga Sage

You can use email.setFrom from the mail script. Refer the below documentation for reference

https://docs.servicenow.com/bundle/sandiego-servicenow-platform/page/script/server-scripting/referen...

Thank you,
Palani

Ethan Davies
Mega Sage
Mega Sage

Hey Mag,

There are two ways you can do this at a notification level:

  1. From field in Advanced view
    find_real_file.png
  2. Set From in Mail Script
    email.setFrom();

If you wanted to change it instance wide, you would need changing or creating a new Email Account on your instance:

find_real_file.png

Please mark this answer as correct or helpful if it solved your issue.

Hi  Ethan

How to do this in flow?

Lihini Dissanayake