Changing sender name on email

Roberto Cortina
Tera Contributor

Hi everyone,

I'm sending an email using a Script Include, in order to send it I'm just inserting a record in sys_email table with Type "send-ready". Then, after the record is inserted I attach a file to the record and ServiceNow sends the email automatically. The problem here is that I want to change the name of the sender. Is there a way to do it without using notifications, events and email templates?

Regards

 

1 ACCEPTED SOLUTION

Tony Chatfield1
Kilo Patron

Hi, you could use  a notification email script
email.setFrom(“AnyName <” + dot.walktoemailaddress + “>”

https://docs.servicenow.com/bundle/sandiego-servicenow-platform/page/script/server-scripting/reference/r_MailScriptAPI.html


But trying a quick test and setting a 'From' field in a notification template,
this results in the value being pushed into sys_email.user when the notification is triggered.
So perhaps you can set the value of sys_email.user during your initial sys_email record insert, using a string with the format.

'a user name <an email address>'

View solution in original post

2 REPLIES 2

Tony Chatfield1
Kilo Patron

Hi, you could use  a notification email script
email.setFrom(“AnyName <” + dot.walktoemailaddress + “>”

https://docs.servicenow.com/bundle/sandiego-servicenow-platform/page/script/server-scripting/reference/r_MailScriptAPI.html


But trying a quick test and setting a 'From' field in a notification template,
this results in the value being pushed into sys_email.user when the notification is triggered.
So perhaps you can set the value of sys_email.user during your initial sys_email record insert, using a string with the format.

'a user name <an email address>'

It worked! I just filled the "User" field in sys_email with the alias and email address. Thanks!