What replaces IIS SMTP server in Windows Server 2012

smtpwindows-server-2012

I have read the notes here http://technet.microsoft.com/en-us/library/hh831568.aspx regarding deprecated and removed features in Windows 2012 and it says that SMTP is deprecated. I assume this is referring to the IIS SMTP server. The advice is to use System.Net.Smtp instead but I assume this is a misprint because I can't find any references elsewhere to anything called System.Net.Smtp.

If they actually meant to say System.Net.Mail, that is just an API and I fail to see how an API replaces a server process. I need a service that accepts connections on port 25 and routes the email to the destination like IIS SMTP used to do.

Can anyone clarify the situation here please? If they had said it was replaced by Exchange then I would curse at them but at least that would me a meaningful statement to make whereas the current one most definitely is not.

Best Answer

I think the referenced statement from Microsoft is just terrible and completely confusing and I don't think whoever wrote it has any clue about how the SMTP server even works. It doesn't explain why it is deprecated or if anything is wrong with it. Perhaps there are security problems or buffer overruns, but if you're not exposing it on a public port I wouldn't hesitate to use it.

Here's what I do :

  • In IIS I set up 'SMTP Email' for the domain to point to 10.0.0.1. I do this in the parent folder to any deployed sites or else it will get erased when you redeploy. If you want you can put it directly in web.config but its less flexible that way.
  • In the SMTP Server (through IIS6 Management Console) I set up an SMTP server at 10.0.0.1. Obviously as I said before this isn't exposed on the public internet.
  • I configure this server to relay through a Smart Host via smtp.gmail.com or smtp.live.com
  • In my .NET application I use the Mail API to send a message using a new SmtpClient(). This picks up the configuration from IIS and sends the mail to my SMTP server at 10.0.0.1
  • When i send a mail it returns instantly because it's just being send to localhost

  • Now this is the important benefit of using a local SMTP server that cannot be understated and for which 'System.Net.Smtp' in itself is no substitute:

    • The SMTP server will try to relay the mail through your smarthost for you and if it can't immediately send it will retry later.
    • It's important to realize that sometimes even smtp.gmail.com won't reply or perhaps your network is down. (Surprisingly common when I first tried sending mail directly)
    • Without an intermediate SMTP server to store the messages you can't just 'send and forget' from .NET and you'd have to figure out some kind of retry mechanism which is completely unnecessary with an SMTP server which does it all for you
    • I believe that if you have an SMTP relay limit (on your ISP/GMail) then the SMTP server will just keep retrying and send the messages the next day - another huge benefit if you have inconsistent traffic from day to day or hit you limit without realizing.

Go ahead and use it. Microsoft hasn't provided a replacement, and it's free so why not. 'Deprecated' means nothing in my opinion if there's no replacement.

Disclaimer: I'm still on Server 2008 but I assume all this still applies.