Restarting Database Mail When it Stops

SQL Server Database Mail is a feature that gives you the option to send emails from your SQL Server. Do you need some basic alerting for SQL Server errors or issues? What about some simple reporting or checks on your data? Database Mail can be the solution you need.

I’ve used it in one form or another since I first started using SQL Server some 15 years ago, and it’s almost always been stable and reliable.

Almost.

What do you do when Database Mail suddenly stops?

Stopped Database Mail

I came across an odd issue last week. At least it was odd to me. I noticed my inbox was missing emails from a particular SQL Server. I logged onto the server and checked the job in question. The step unrelated to Database Mail was completing, but what about the step for sending an email? For that step, it was failing with the message:

Well, that’s new. Maybe I’ve been lucky as I had not seen that issue before.

Getting Restarted

Database Mail had been configured for awhile on this server with no issues. I figured I’d try starting it back up, while half expecting to get a different error that would point me towards why Database Mail stopped running.

I did a quick search on sysmail_start_sp and there wasn’t much to it. Getting Database Mail restarted was as simple as following the directions in the error message.

USE msdb;
GO

EXECUTE dbo.sysmail_start_sp;
GO

That completed successfully. I used Database Mail to send a test email and all was well. I checked the job that was failing, and it completed successfully.

But Why

So why did Database Mail stop in the first place? I’m not sure. Logs looked clean, and nothing else looked suspicious. Time will tell if the issue pops up again. I’m still doing some research, but for now, I’ll keep a closer eye on it for a bit and chalk it up as a fluke.

Thanks for reading!

One thought on “Restarting Database Mail When it Stops”

Leave a comment