Email: different "from" address *display name* for a given notification

dmartinc
Tera Expert

Hello,

As explained in the documentation, it is possible to change the "From" address used by a particular Email Notification from the default one:
http://wiki.service-now.com/index.php?title=Scripting_for_Email_Notifications#Overriding_Email_Fields
This works well as long as one remembers to do email.setReplyTo() in addition to email.setFrom().

However, I am trying to change the "display name" of the "from" address. I would like a different value from the one in the 'glide.email.username' system property (e.g. 'Help Desk').

Since I see no method in the documentation or when introspecting the 'email' object, I thought I could write a "on before update" Business Rule that rewrites the headers of a sys_email record before it is sent.
And I think I succeeded, because the headers in the sys_email record do change. But when I look at the mail that arrives to my personal inbox, the headers still show the default value (e.g. "Help Desk" instead of "No reply - Help Desk" which I am trying to achieve).

Can anyone offer any help / advice?

Thanks for reading,
David

1 ACCEPTED SOLUTION

dmartinc
Tera Expert

Hello Harish, Saravanan,



To clarify, you have to do the following inside the "Message" field of your Email Notification or Email Template record:



<mail_script>


email.setFrom("Display Name <some.address @ company.com>");


email.setReplyTo("Display Name <some.address @ company.com>");


</mail_script>



(without the spaces around the @ character, which I added to avoid the email address to be mis-formatted by the comments system of this website)



Best regards,


David


View solution in original post

7 REPLIES 7

Thanks a lot David.. It works


ceu
Tera Contributor

This seems to be standard if you use the advanced view.

Specify alternative outbound email addresses for notifications (servicenow.com)

 

Regards,

Christophe

KamerT
Tera Contributor

We can configure both the display name and email address/DL in the notification's From field using the following format:

Format:

Display Name<email id>

Example:

From: Test Incident <Testincident@gmail.com>