The server is running on:
- Windows Server Standard on SP2
- IIS 7 with ASP.NET 1.1
- IIS 6 for SMTP
The server hosts many websites running ASP.NET 1.1. These websites use the built in SMTP server on IIS6.
The SMTP works fine for a while but after a few weeks or months, It will stop sending emails. I tried sending one via Telnet it seems fine so the SMTP server is not the issue.
I tried restarting the Application Pools but it had not effect whatsoever. I also tried restarting IIS 7.0 and IIS 6.0 it still will not send messages.
The only temporary way we found to fix this was to restart the server.
Is there an ASP.NET cache that we can clear or is causing this issue?
UPDATE:
Got the fix!
It was a hunch but I restarted the Print Spooler and DNS Client services in the server and now emails are sent successfully.
But I still do now know why this happens for ASP.NET 1.1 projects.
UPDATE 2:
Issue appeared again today! I got lucky I thought I had to wait weeks to test it again.
I started by restarting the DNS Client service. No effect still cannot send emails. I then restarted the Print Spooler service and to my surprise it was the culprit! ?????????
How is this even, what, why? huh?
I disabled the Print Spooler permanently. Email still works. I do not think we print anything or if the Print Spooler does any other tasks other than printing.
If it does do anything please comment below.
UPDATE 3:
The fix was temporary. I found out today that WINSOCK refused connections from ASP.NET but accepted connections via telnet mail.
Still trying to find out why this is happening.
UPDATE 4:
Well finally made a reboot with the WINSOCK corruption fixes applied. Hope this holds forever and the bug does not reappear.
Added this to my blog: http://www.moushigo.com/index.php/2012/02/22/trivial-smtp-asp-net-winsock-connectivity-issues/
You might want to consider using an external email delivery service such as AWS SES, Mailgun, Portmark or Sendgrid. This will likely also increase the deliverability of your emails.
Got the fix!
It was a hunch but I restarted the Print Spooler and DNS Client services in the server and now emails are sent successfully.
But I still do now know why this happens for ASP.NET 1.1 projects.
The REAL question is: why did restarting unrelated services fix the issue? (Print spooler???) DNS is relevant, I'll give you that. But still - this is weird. I agree with Friism that using an external SMTP server would be nicer, they're so easy to connect to in ASP.NET that you might as well go straight to a white listed SMTP server, authenticated and all, as opposed to using a local relay server. Relaying email seems to be a very iffy process with all the rules about spam and what not these days.
Another tip for sending through external SMTP servers, is to use port 587 as opposed to port 25. Some ISPs don't like people using port 25 for anything other than their own preferred mail server.