How send email notifications from different email addresses with different display name

mayurk
Tera Contributor

Hi Developers,

As per one requirement I need to configure different 'From' email address for one of the notification so that mail will be delivered to users with different email address other than email address of outbound email account of SN Instance. I achieved this by filling different email address in 'From' field of particular email notification. Now emails appearing to be coming from email address that i configured in 'From' field. But still display name is same as 'Email user label' value of outbound email account.

For example,

header of initial Outbound email is looking like this.

SERVICENOW Prod <servicenowprod@xyz.com>

When I configured different email address say 'Testservicenowprod@xyz.com' in 'From' field, mails started coming as

SERVICENOW Prod <Testservicenowprod@xyz.com>


Now display name 'SERVICENOW Prod' is from the outbound SMTP account configured. I want to change this so that outbound email will look like


SERVICENOW Test <Testservicenowprod@xyz.com>


Please help me to resolve this.

Thanks in advance....


8 REPLIES 8

Please close the question by marking the response/responses as helpful or correct.


The question is still not closed. Please click correct or assume  answered

Jaskaran Walia
Kilo Guru

Not sure if you got the answer but I had similar requirement and figured out a way. Thought would share with you!

 

You can do it 2 ways
1) In the notification, you can use the below format in the from field
TEST NAME <ab@gmail.com>

2) If you want to use mail script, use the format below.
email.setFrom("TEST NAME <ab@gmail.com>");

Note: if you are using mail script, the From should be blank in notification otherwise it will not work as From field in notification take precedence over the email script value.

Great summary, thanks