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 :
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.10.0.0.1
. Obviously as I said before this isn't exposed on the public internet.smtp.gmail.com
orsmtp.live.com
new SmtpClient()
. This picks up the configuration from IIS and sends the mail to my SMTP server at10.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:
smtp.gmail.com
won't reply or perhaps your network is down. (Surprisingly common when I first tried sending mail directly)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.