SQL Server 2016 Database Mail cannot send email smtp.office365.com

drcz 21 Reputation points
2020-12-03T06:34:02.883+00:00

SQL Server 2016 Database Mail and I get this error: Message The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 3 (2020-12-02T22:03:59). Exception Message: Cannot send mails to mail server. (Failure sending mail.). ) The configuration I use
Server: smtp.office365.com Port Number: 587 Authentication: Basic (An email address and password)

The server has disabled all SSL3 TLS 1.0 and 1.1, enabled TLS 1.2 Also .NET 4.7.1

Still not working...

SQL Server | Other
0 comments No comments
{count} votes

Answer accepted by question author
  1. AmeliaGu-MSFT 14,011 Reputation points Microsoft External Staff
    2020-12-08T08:00:26.597+00:00

    Hi @drcz ,
    In addition, have you ticked “This server requires a secure connection(SSL)” in account tab?
    Please refer to this similar thread:

    Below is the content for a simple executable registry file that I put together that will make the 2 new settings and the settings already shown on the thread above (i.e. this makes all of the necessary Registry settings*):
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v4.0.30319]
    "SchUseStrongCrypto"=dword:00000001

    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319]
    "SchUseStrongCrypto"=dword:00000001

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2]

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client]
    "DisabledByDefault"=dword:00000000
    "Enabled"=dword:00000001

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server]
    "DisabledByDefault"=dword:00000000
    "Enabled"=dword:00000001
    Note 1: SQL needs to be restarted for these settings to take affect but it is better to restart Windows since the new settings will affect .NET 4.x generally.

    Note 2: In SQL, the SSL-checkbox must be ticked in the mail profile to use TLS1.2.

    Best Regards,
    Amelia


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    4 people found this answer helpful.
    0 comments No comments

5 additional answers

Sort by: Most helpful
  1. drcz 21 Reputation points
    2020-12-08T20:52:40.96+00:00

    I did used this tutorial https://www.jorgebernhardt.com/disable-ssl-and-tls-on-winserv/ and TLS 1.2 was there.
    What was missing were two I did added manually:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v4.0.30319]
    "SchUseStrongCrypto"=dword:00000001
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319]
    "SchUseStrongCrypto"=dword:00000001
    

    Also meanwhile I had to add SSL certificate to the server using this tutorial https://www.youtube.com/watch?v=UvoEYqB0tXw&ab_channel=TipsForITPros
    In MMC I had to double click the SQL Server and I changed the Account Name https://thesqldude.com/2011/08/03/sql-server-service-does-not-start-after-enabling-ssl-encryption/

    thank you!

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.