patternsqlMinor
Database mail trying to send 2 times and then failing
Viewed 0 times
failingtryingdatabasemailthenandtimessend
Problem
Our database mail was running for 3 years without problems, but since one week, we are often (but not always) getting this error:
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2021-10-13T22:31:21).
Exception Message: Cannot send mails to mail server. (Failure sending
mail.). )
Unfortunately this message is not very helpful. Database mail is always trying to send the mail 2 times (with 1 minute interval), then it finally fails.
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2021-10-13T22:31:21).
Exception Message: Cannot send mails to mail server. (Failure sending
mail.). )
Unfortunately this message is not very helpful. Database mail is always trying to send the mail 2 times (with 1 minute interval), then it finally fails.
- Is there a way to find out why exactly it is failing? ?
- Is there a way to reconfigure database mail, so that it tries more often or sends in other ways?
Solution
I discovered this week that we have been having the same problem. It started really around 10/1 and had been on and off, but not serious enough to come to my attention. This week, though, it had gotten much more severe. Yesterday I couldn't get a single email out from any of our 3 DBs, all routing through SMTP at Office 365. You don't mention your SMTP, so this may or may not be the issue for you.
Doing some digging, the one fix I could find that I believe addresses this issue is here: https://dba.stackexchange.com/a/233249/131993
Once we used that registry executable on the machine with SQL Server I was able to reliably send email on the first try. I sent around 150 messages after that fix with no issues. Because it's intermittent, I can't say with 100% certainty the issue is fixed, but so far it looks good.
Doing some digging, the one fix I could find that I believe addresses this issue is here: https://dba.stackexchange.com/a/233249/131993
Once we used that registry executable on the machine with SQL Server I was able to reliably send email on the first try. I sent around 150 messages after that fix with no issues. Because it's intermittent, I can't say with 100% certainty the issue is fixed, but so far it looks good.
Context
StackExchange Database Administrators Q#301122, answer score: 4
Revisions (0)
No revisions yet.