The most popular blog post on my site is how to send email to ASP.NET (C# code sample). It seems that a recurring question/comment on that post though is from people with issues with the code being rejected when trying to relay email through “localhost” (an assumed running local SMTP service). So, here’s a post walking through the setup of Microsoft’s SMTP service on Windows Server 2008.
The process starts with the Windows Server 2008 Server Manager. From here choose Features then Add Features.
Your next screen presents a list of Features that are options to be installed. Scroll through the list and find the SMTP Server feature as shown.
Once you check that box another window will pop up letting you know that the IIS role is required for the SMTP services; so are the IIS6 management tools (don’t ask me why but Microsoft decided to leave SMTP management out of the IIS7 interface so you actually have to use the previous [IIS6] tools). Click the box to Add Required Role Services.
That drops us back to the previous screen where you only need to click Next to get things started.
The next window that pops-up has a lot of words… read it if you are bored, or just click Next.
Okay, this next screen actually has some value – but more FYI than anything. You’ll notice that as part of the installation it is going to install the ODBC logging (so that you can have logging for your SMTP service), IIS6 Compatibility, and the IIS6 Management Tools (for the reason already mentioned). Don’t change anything here – just leave the defaults, since they are required, and click Next.
Now it’s time for an FYI screen… just in case you got this far by accident and wanted to cancel the installation.
Hey, look at that – we’re done! You now have Microsoft’s SMTP service installed locally on your Windows Server 2008 machine… and you can use it to relay email to your heart’s desire.
There’s still one more step to make this work properly though. It’s not part of the install so I’ll make that another post.
Configuring Microsoft’s SMTP Service to allow relay from code (or services) running locally on the server.
Happy hosting!