mike_zelnik
ServiceNow Employee

Hi Charlie,



If you want to quickly get all of the emails in your Outbox to your Skipped mailbox, you can run this script:



var rec = new GlideRecord('sys_email');


rec.addQuery('type','send-ready');


rec.query();


while (rec.next()) {


  rec.type = 'send-ignored';


  gs.print('Email ' + rec.subject + ' ignored');


  rec.update();


}



The Type field determines which mailbox emails are placed in and whether or not the SMTP Sender job picks them up.



It's also always a good idea to set the glide.email.test.user property on your sub-prod instances when enabling email sending.



Regards,
Mike


Hi Mike,

I've used your script it cleaned my outbox but all new emails also have the status ignored do you know why?

Is the script working in the background? How to fix it?

SanjivMeher
Mega Patron

Set the test email address to your email id and enable the email. Then you can just delete all the emails you received from your servicenow instance in your outlook.


find_real_file.png


Do I need to have the "email sending enabled" setting checked to receive the emails in Dev - or will it send it to everyone.


find_real_file.png


mike_zelnik
ServiceNow Employee

Anthony,



That is the master switch for enabling sending on the instance.   You need it checked for any emails to be sent.   If you have it enabled, then ALL (type = send-ready) emails will be sent to the test email address you have defined in the next field.



R,
Mike