1

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.

  • 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?
4
  • 2
  • You could also get with your Mail administrator and be sure that the server attempting to send emails to the mail server has the appropriate permissions to do so.
    – rvsc48
    Oct 14 at 14:33
  • @rvsc48 It's not always failing, some mails are sent successfully. I've edited the question.
    – askolotl
    Oct 14 at 19:25
  • which SMTP server your database server is using ? is it on the same machine as database server, or on some another server ? 1 hour ago
0

I can definitely answer at least the second part of your question. It is possible to configure retry attempts and the retry delay that Database Mail uses. You can do this with the sysmail_configure_sp procedure (see the AccountRetryAttempts and AccountRetryDelay parameters), or you can configure the same settings through SSMS by right clicking on Database Mail in the Object Explorer and going to the "View or change system parameters" screen.

On the first part of your question about identifying the root cause of the failure, you could try checking system and application logs in Event Viewer or the SQL Server logs to see if this gives any extra detail about the errors. Also, I have seen an error like this recently caused by a change TLS support in Office 365 so if you are using Office 365 as your mail server you could also sanity check that SQL Server is on a version that supports TLS 1.2, as TLS 1.0 and 1.1 are no longer officially supported by Office 365 and lately they only work inconsistently.

New contributor
Brenton is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.