- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 11:43 AM
Can I set the 'TO' address in an mailto script? It reads from the system property, but I only want to change it for a specific email, not system wide. Let's say I want it to go to my personal email instead of the system email. This is NOT for a reply email - it is for a mailto: link in my email.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 11:08 AM - edited 03-18-2025 11:10 AM
Hello @Terri Welch
Dummy email script
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
var approverEmail = "abc@gmail.com"; // Replace
var subject = "Project Approval Decision";
// Generate mailto links with action in the subject - please modify them as per your requirement
var acceptLink = 'mailto:' + approverEmail + '?subject=' + encodeURIComponent(subject + ' - Accept');
var deferLink = 'mailto:' + approverEmail + '?subject=' + encodeURIComponent(subject + ' - Defer');
var declineLink = 'mailto:' + approverEmail + '?subject=' + encodeURIComponent(subject + ' - Decline');
// Output the links for use in the email body
template.print('<p>Click below to respond:</p>');
template.print('<p><a href="' + acceptLink + '"> Accept</a></p>');
template.print('<p><a href="' + deferLink + '"> Defer</a></p>');
template.print('<p><a href="' + declineLink + '"> Decline</a></p>');
})(current, template, email, email_action, event);
You can modify this dummy script to have different email address for accept, defer and decline.
Dummy Email Notification Message HTML
Hi
To waste your time, a request has been submitted to you for accept/reject/defer by clicking on one of the options below:
${mail_script:dummy_script}
Thanks
ServiceNow
Validation results:
Hope that helps!
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 11:08 AM - edited 03-18-2025 11:10 AM
Hello @Terri Welch
Dummy email script
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
var approverEmail = "abc@gmail.com"; // Replace
var subject = "Project Approval Decision";
// Generate mailto links with action in the subject - please modify them as per your requirement
var acceptLink = 'mailto:' + approverEmail + '?subject=' + encodeURIComponent(subject + ' - Accept');
var deferLink = 'mailto:' + approverEmail + '?subject=' + encodeURIComponent(subject + ' - Defer');
var declineLink = 'mailto:' + approverEmail + '?subject=' + encodeURIComponent(subject + ' - Decline');
// Output the links for use in the email body
template.print('<p>Click below to respond:</p>');
template.print('<p><a href="' + acceptLink + '"> Accept</a></p>');
template.print('<p><a href="' + deferLink + '"> Defer</a></p>');
template.print('<p><a href="' + declineLink + '"> Decline</a></p>');
})(current, template, email, email_action, event);
You can modify this dummy script to have different email address for accept, defer and decline.
Dummy Email Notification Message HTML
Hi
To waste your time, a request has been submitted to you for accept/reject/defer by clicking on one of the options below:
${mail_script:dummy_script}
Thanks
ServiceNow
Validation results:
Hope that helps!
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 12:31 PM
Thank you vishal_jaswal - This works exactly as I needed.