Email Masking

Mannu
Kilo Contributor

Hi All,

I have single notification. I want to change the "FROM" of email notification based on "opened by" country.

For example: I have 3 countries India, Australia, Canada.

If user selected in opened by is from India, it should trigger notification with email ID : India@example.com

If user selected in opened by is from Australia, it should trigger notification with email ID : Australia@example.com

f user selected in opened by is from Canada, it should trigger notification with email ID : Canada@example.com

I don't want to create multiple notifications based on countries and set FROM static.

Thanks

1 REPLY 1

Mike Patel
Tera Sage

You can do this using mail script

create mailscript with something like below and add that mailscript to notification.

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

	if(current.opened_by.country == "India"){
		var sender = "India Support <indiasupport@sn.com>";
		email.setFrom(sender);
	}else if (current.opened_by.country == "Australia"){
		var sender2 = "Australia Support <Australiasupport@sn.com>";
		email.setFrom(sender2);
	}
})(current, template, email, email_action, event);