2

I'm trying to send database mail over SSL/TLS-encrypted SMTP. It works when sending plain text email, but fails when I enable SSL/TLS.

The database mail log shows the following error message:

Date        6/02/2019 11:07:09 AM
Log     Database Mail (Database Mail Log)

Log ID      11
Process ID      9476
Mail Item ID    6
Last Modified   6/02/2019 11:07:09 AM
Last Modified By    sa

Message
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2019-02-06T11:07:09). Exception Message: Cannot send mails to mail server. (The remote certificate is invalid according to the validation procedure.).
)

How can I find out more information about why SQL Server doesn't like the certificate?

  • Did you this one? social.msdn.microsoft.com/Forums/aspnet/en-US/… – SqlWorldWide Feb 7 at 14:32
  • Thanks for the link. I don't find any of the details on that page very helpful. The ASP.NET troubleshooting advice is hard to apply to SMTP with STARTTLS; I don't know how to view the certificate that is being presented to the SMTP client in this circumstance. Same for testing the connection with telnet. My set up doesn't use Windows Authentication, so that's not relevant. – Hydrargyrum Feb 7 at 14:44
  • I don't have a generic SMTP mail client installed on my SQL Server box, but I'll look into whether I can install one to troubleshoot the encryption behaviour with hopefully better error messages. – Hydrargyrum Feb 7 at 14:45
  • 1
    It turns out that the certificate issue was caused by the hostname I was connecting to using two levels of subdomain, while the wildcard certificate was only valid for one level of subdomain. I was able to diagnose the certificate problem by using a copy of OpenSSL that was installed as part of an XAMPP stack on the same machine (see stackoverflow.com/questions/54549656/…). I'll leave this question open in case anyone wants to suggest a way to diagnose this fault without installing a whole stack of unrelated software. – Hydrargyrum Feb 8 at 5:22

Your Answer

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

Browse other questions tagged or ask your own question.