Database Mail Setup SQL Server 2008 R2 RRS feed

  • Question

  • Hi,

    I have an error when I try to send an email with database mail. Please see below.

    Currently,  I use gmail as a mail server . Here the details:


    I use basic authentication and provide the mail account and the password.

    The error I am getting after I execute the sp_send_dbmail from the sysmail_event_log is:

    The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2009-12-28T18:17:15). Exception Message: Cannot send mails to mail server. (The remote certificate is invalid according to the validation procedure.). )

    I didn't find anything helpful on the web so far.

    We just moved to SQL Server 2008 R2 and this was working just fine on SQL Server 2008.

    Please advice.



    • Moved by Todd McDermid Thursday, May 6, 2010 10:45 PM Q about Database Mail (From:SQL Server Integration Services)
    Thursday, May 6, 2010 10:19 PM


All replies

  • It looks like the mail server is rejecting the connection. Have you tried using telnet from the sql server and connecting to the SMTP Port at gmail. You should be able to connect and pass the HELO Command to verify the connection. - XNA Game Programming News and Resources from Downunder.
    Thursday, May 6, 2010 11:37 PM
  • Glenn,

    Thanks for your response on that.

    Sorry, I am not really a telnet expert....How would I do that?

    I also changed the port to 465 and disabled and enabled SSL..however email didn't send with a time out error message.

    I also enabled pop, required by gmail...

    that thing puzzles me:)




    Friday, May 7, 2010 2:26 AM
  • Maybe this link will be able to help you, it shows you the telnet method I was talking about.

   - XNA Game Programming News and Resources from Downunder.
    Friday, May 7, 2010 10:15 AM
  • No, but I got it to work on a different machine and used this instead and there it worked without any issue...Thx Ludwig

    Friday, January 7, 2011 3:45 AM
  • Perhaps the SMTP server is not configured for relay

    The sender IP address which is the IP address of the SQL Server in this case should be in the allowed list for relay

    You can manage it on the IIS server

    SQL Server Articles
    Friday, January 7, 2011 9:50 AM
  • The smtp/mail server should be configured to accept connections from the SQL Server. Work with your mail admin allow mails from SQL Server instance.
    Friday, January 7, 2011 9:56 AM
  • best article about database mail on sql server 2008 R2

    hope it helps.

    Saturday, August 27, 2011 7:57 AM
  • I am having same issue as OP. However, I do not believe this is a response from the receiving SMTP server. This seems to be a SQL specific certificate check in Database Mail. Here is why I think that.

    Using SendEmail utility I was able to successfullly send from the SQL server with the same server address, email address, SMTP authentication, port, and TLS to on.

    In database mail if I use all the same settings I get "the remote certificate..." message.

    This tells me that SQL Database Mail is checking the certificate of the receiving SMTP server more closely than most other SMTP client applications. However, it is not giving complete details on what it doesn't like about the cert.

    Is there a way to turn this checking off?

    Tuesday, February 9, 2016 4:35 PM