0

I have set up various emails (Outlook and Gmail) with proper SMTP settings, yet database mail will not work.

The mail is stuck in the queue.

How do I get the mail to function?

Set up Outlook, then Gmail accounts to use, but neither worked.

I got this error:

"Date 2/22/2023 7:58:37 AM
Log Database Mail (Database Mail Log)

Log ID 1057
Process ID 8752
Mail Item ID 19
Last Modified 2/22/2023 7:58:37 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 2 (2023-02-22T07:58:37).

Exception Message:

Exception Type: Microsoft.SqlServer.Management.SqlIMail.MailFramework.Exceptions.BaseMailFrameworkException

Message: Cannot send mails to mail server. (The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at)

Data: System.Collections.ListDictionaryInternal
TargetSite: Void Send(Microsoft.SqlServer.Management.SqlIMail.MailFramework.Framework.IMessage)
HelpLink: NULL
Source: DatabaseMailProtocols
HResult: -2146232832

StackTrace information

at Microsoft.SqlServer.Management.SqlIMail.MailFramework.Smtp.SmtpMailSender.Send(IMessage msg)
at Microsoft.SqlServer.Management.SqlIMail.Server.Controller.ProfileMailSender.SendMailToAccount(Account a, IMessageSender ms, OutMailItem si)

Exception information

Exception Type: System.Net.Mail.SmtpException
StatusCode: MustIssueStartTlsFirst
Message: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at
Data: System.Collections.ListDictionaryInternal
TargetSite: Void CheckResponse(System.Net.Mail.SmtpStatusCode, System.String)
HelpLink: NULL
Source: System
HResult: -2146233088

StackTrace

at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)
at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, MailAddress from, Boolean allowUnicode) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at Microsoft.SqlServer.Management.SqlIMail.MailFramework.Smtp.SmtpMailSender.Send(IMessage msg). )

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
  • 1
    GMail stopped allowing basic SMTP authentication years ago without explicit configuration. Last year the option was removed completely. I suspect it's the same with Outlook 365 – Panagiotis Kanavos Feb 22 '23 at 13:48
  • Does this answer your question? [Gmail Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required](https://stackoverflow.com/questions/20906077/gmail-error-the-smtp-server-requires-a-secure-connection-or-the-client-was-not) – Panagiotis Kanavos Feb 22 '23 at 13:49
  • I will review this information later, I am supposed to be working now. This looks promising. Thank you. – Edward King Feb 22 '23 at 14:34
  • That link says `you can't`. It's not exactly promising. A better idea would be to install a small SMTP server on your machine that only listens to SQL Server. In the past, IIS came with an SMTP service but that was discontinued. – Panagiotis Kanavos Feb 22 '23 at 14:40
  • If it's a dev machine, you can add a Docker container with an SMTP service – Panagiotis Kanavos Feb 22 '23 at 14:50
  • OK. Thank you. You save me a lot of time. I guess database mail is no longer a function in SQL Server Developer. – Edward King Feb 22 '23 at 17:10
  • On the contrary, Database mail is still alive and well. You still need an email server though, and neither Gmail nor Office 365 allow their SMTP servers to be used that way any more, at least not for free accounts. They were being abused for spam and fraud and identity spoofing, so all providers first increased security, then dropped the feature altogether. Their cloud divisions have their own, paid, mass mailing offerings. – Panagiotis Kanavos Feb 23 '23 at 08:35
  • Ok. Thank you. I will try to find something that works with SQL Server Developer. – Edward King Feb 23 '23 at 14:52

0 Answers0