Script to monitor Email Account Connection Status

Ross Drew
Tera Contributor

Has anyone created a script that basically monitors the connection status of an email account? Recently, the token for an email account that we have set up in ServiceNow was expired on the exchange side by an Admin which broke our connection between our instance and the exchange server and no emails were coming into our instance. I was checking to see which logs / tables I need to check that would tell me that the email account connection is broken; similar to what you see on the Email Diagnostics dashboard. Unfortunately, the connection status is not written anywhere that I see. Looking to see if anyone solved this issue.

 

Thanks!

3 REPLIES 3

GB Gabriel T
Mega Guru

Hi, @Ross Drew 

 

You’re right — there’s no OOTB way to persist or query the email account connection status in ServiceNow.

 

The “status” you see in Email Diagnostics is calculated at runtime and not stored anywhere. 


Because of that, the only real option is to infer the connection health indirectly.


In practice, what people do is monitor a combination of:

email activity (e.g., emails suddenly stop flowing)
system/email logs for errors (auth failures, OAuth issues, connection errors)
recent behavior instead of a static status

This is actually aligned with how ServiceNow itself works — the diagnostics dashboard is based on aggregated metrics and recent activity, not a persisted connection state. 


So even though there’s no single field telling you “connection is broken”, you can still detect it reliably by correlating logs and email flow.

 

 

 

 

Thank you! I will give this a try and let you know.

Perfect @Ross Drew ,

if possible, mark my suggestion as valid, I thank you!!! Good luck and I look forward to your reply!!