After configuring an Email subscription, the subscription result shows: “Failure sending mail: One or more errors occurred.“. In this blog post I will share how I investigated and resolved one such failure.
My first step in troubleshooting this error was to query from the ExecutionLog3
view inside the ReportServer
database. I normally do this to check if and why a report subscription has failed its run.
However, in this case all the log records showed success (rsSuccess
status):
This indicates that the querying and rendering done by the report was successful.
This means that the failure happened after the rendering stage, which makes sense because the error message specifically says that the failure was during the “sending email” phase.
Next, I opened the most recent report service log file in the LogFile
folder inside the SSRS installation folder (these are starting with “ReportingServicesService_
“, and are located by default in C:\Program Files\Microsoft SQL Server Reporting Services\SSRS\LogFiles
).
In it, I found the error message below:
emailextension!WindowsService_1!16e4!01/06/2025-04:00:27:: e ERROR: Error sending email. Exception: System.AggregateException: One or more errors occurred. ---> System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 142.251.179.109:25 at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult) at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) --- End of inner exception stack trace --- at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result) at System.Net.Mail.SmtpTransport.EndGetConnection(IAsyncResult result) at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result) --- End of inner exception stack trace --- --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait(TimeSpan timeout) at Microsoft.ReportingServices.EmailDeliveryProvider.EmailProvider.Deliver(Notification notification) ---> (Inner Exception #0) System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 142.251.179.109:25 at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult) at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) --- End of inner exception stack trace --- at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result) at System.Net.Mail.SmtpTransport.EndGetConnection(IAsyncResult result) at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result) --- End of inner exception stack trace ---<--- . Additional Information: SmtpException StatusCode:GeneralFailure
Out of all that noise, the specific error message that interests us is:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 142.251.179.109:25
The incriminating part here is the fact that there’s use of the port “25” right after the IP address of the SMTP server:
###.###.###.###:25
In this specific case, this was an IP address belonging to the GMail SMTP. This explains why sending the emails doesn’t work, because communication with the GMail SMTP server must be done via the port 587.
Unfortunately, when configuring the E-mail settings in the Report Server Configuration Manager, it’s not actually possible to specify the port:
Even though “Use secure connection” is enabled (SSL/TLS), SSRS still decides to use port 25.
This was found as the source of the problem. But how can we change it when there’s no such option in the GUI of Report Server Configuration Manager?
Well, we simply change it without the GUI. We go at it raw, like the crazy hackerpersons that we are! 🤪
The way to do it is by changing a configuration file called “rsreportserver.config
“, located in the SSRS installation folder (by default C:\Program Files\Microsoft SQL Server Reporting Services\SSRS\ReportServer\rsreportserver.config
).
Open this configuration file in notepad and look for the XML element called SMTPServerPort
. You should see that it is empty.
We need to change the inner value of this element (to 587 in our case) and save the file.
Once we save the file, we need to restart the SSRS service to apply the change.
To do so, open the Report Server Configuration Manager, and in the Report Server Status page, click on “Stop
” and after it’s stopped, click on “Start
“.
Once we made this change, the subscriptions were successfully able to send Emails.
Great success!