Windows Server 2019 SMTP Server – Email Stuck in Queue / Not Being Released

iissmtpwindowswindows-server-2008-r2windows-server-2019

I've recently upgraded a number of servers from Windows 2008 R2 to Windows Server 2019. 2 of the servers require SMTP which I have installed on both, however, 1 server works as it should and the 2nd, the emails get stuck in the queue and don't ever get sent/released.

I found this post (which I hoped would solve my problem, but it still persists):
Windows Server 2019 built-in SMTP server: Emails stuck in queue and "The remote server did not respond to a connection attempt" in event log

Upon viewing my Event Log, I found the following Warning messages for SMTPSVC:
Message delivery to the host 'xxx.xxx.xxx.xxx' failed while delivering to the remote domain 'domainname.com' for the following reason: An SMTP protocol error occurred.

I am able to send mail using the following PowerShell script, but email sent via .NET apps and websites is not being released.

Send-MailMessage -SMTPServer localhost -To me@mydomain.com -From smtptest@server2.com -Subject "SMTP Test" -Body "Email test through PowerShell"

Has anyone else dealt with SMTP issues on Windows Server 2019? Any thoughts or additional resources would be greatly appreciated.

UPDATE

Sending mail through PowerShell continues to work, however, sending mail through ASP.NET webforms/apps seems to not connect. Running a Wireshark trace, there is no SMTP activity when mail is sent through .NET apps. My SMTP log is as follows:

18:24:14 127.0.0.1 MAIL – 250

18:24:14 127.0.0.1 RCPT – 250

18:24:14 127.0.0.1 DATA – 250

18:25:48 127.0.0.1 QUIT – 240

The mail is generated, however it is just left in the Queue folder and never gets sent.

Currently, the .NET apps are set to connect to localhost, I've tried updating this to 127.0.0.1 as well.

Best Answer

In my case, it turned out to be AWS preventing the emails leaving the server.

"Important: Amazon Elastic Compute Cloud (Amazon EC2) restricts Amazon Virtual Private Cloud (Amazon VPC) egress traffic on port 25 for all EC2 instances by default. If your application requires traffic on SMTP port 25, you can request to remove this restriction."