Confirmation before sending email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 12:46 AM
Hi,
Before sending an email, I would like to confirm whether the address of the recipient is wrong by a popup or something.
I would like to check and send if there is no problem.
Mail is intended for suggesting solutions to incidents as implemented in OOB.
If anyone knows how to implement it or how it can be done with OOB functionality, please let me know.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 12:54 AM
Hi @Yudai Yamamoto
May I know from where you are trying to send email?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 01:05 AM
Hello @Yudai Yamamoto
I am assuming you mean recommended KB Articles that are sent after creating an incident?
This you need to add a mail script to check the .
var recipientEmail = email.to; // Get the 'To' email address
// Check if it's a valid user in sys_user table
var user = new GlideRecord('sys_user');
user.addQuery('email', recipientEmail);
user.query();
if (!user.next()) {
gs.log('Invalid recipient email: ' + recipientEmail);
/ Stop the email from being sent
}
Another option business rule on sys_email table, current.type == send and other filters.
if (current.type == 'send') {
var recipientEmail = current.recipients.toString(); // Get the 'To' email address
var user = new GlideRecord('sys_user');
user.addQuery('email', recipientEmail);
user.query();
if (!user.next()) {
gs.log('Email not sent. Invalid recipient: ' + recipientEmail);
current.setAbortAction(true); // Prevents email from being sent
}
}
Kindly mark my answer as helpful and accept solution if it helped you in anyway,
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwN
eEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2025 12:32 AM - edited 04-02-2025 12:32 AM
Thank you for your comment. I would like to confirm the content and address of the email associated with the case before it is sent to an external user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2025 12:41 AM
Hello @Yudai Yamamoto
That's what the mail script does that I shared does. It is checking the mail address in sys_user table, if it is found there, then fine, else it's aborting the action.
For the content also you just need to add in between, you can do same access the body "email.body_text" if it's fine you can send it.