- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 04:56 AM
I'm trying to delete all outbox emails with a ready state. I want to do some testing with a few users without it sending everyone in the company emails since this was a clone from PRD. Any assistance would be greatly appreciated. I tried to via Tables & Columns but there is no "delete all records" option for the Email table.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 05:50 AM
Yes, you can add any user you want and they will all receive the email. The property is set to prevent test data to be send to people not knowing it is test data, which could lead to huge issues. Kudos you thought about deleting the email box first. I have seen differently over time which lead to lots of excuses.
Use the script shared by Ashish as background script.
By the way: if you have 16K emails in the outbox, you either have an issue on PROD (if it was a recent clone) or it's a cumulation over time. Best thing to do, is to get a test-mailbox and add that in the property, so the emails are always send out to that box. Put a rule on it to delete all received emails from the dev instance after a week and you will never have this issue again (somebody could check 'send email' by accident and not think about deleting the outbox content first).
Or put a scheduled job on it to clear the outbox every day, or something like that.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 05:23 AM
You can go to the 'outbox', select all emails and use the delete option for the list.
Also: use the system property on the email property page (https://[your_instance].service-now.com/now/nav/ui/classic/params/target/email_properties.do) to send emails to test email addresses, to prevent any other notifications being triggered being send to real people. Do this, before you activate 'email sending enabled'.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 05:31 AM
Thanks Mark, the only thing is I have about 16k in the outbox and I would have to do 20 emails at a time. Also, can I enter multiple users for testing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 05:50 AM
Yes, you can add any user you want and they will all receive the email. The property is set to prevent test data to be send to people not knowing it is test data, which could lead to huge issues. Kudos you thought about deleting the email box first. I have seen differently over time which lead to lots of excuses.
Use the script shared by Ashish as background script.
By the way: if you have 16K emails in the outbox, you either have an issue on PROD (if it was a recent clone) or it's a cumulation over time. Best thing to do, is to get a test-mailbox and add that in the property, so the emails are always send out to that box. Put a rule on it to delete all received emails from the dev instance after a week and you will never have this issue again (somebody could check 'send email' by accident and not think about deleting the outbox content first).
Or put a scheduled job on it to clear the outbox every day, or something like that.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2024 05:28 AM
Do as Mark pointed or use background script to delete the records (which is actually the same but done in different way):
var grSysEmail = new GlideRecord('sys_email');
grSysEmail.addEncodedQuery("mailbox=outbox^state=ready");
grSysEmail.query();
while (grSysEmail.next()) {
grSysEmail.setWorkflow(false);
grSysEmail.deleteRecord();
}