SMTP Configuration on Rackspace Cloud Servers, Windows

Posted on 2/21/2011 | Printable Version | Comments (0)

As it turns out, configuring SMTP for asp.net applications to send simple email messages in Windows Server 2008 is not exactly straight forward. I think Microsoft is focussed on organizations with exchange servers ready to go, and as a result they have left us web hosting types out in the cold. How disappointing! But alas, we are a resourceful bunch. I spent a good chunk of my morning working this one out, and the answer has a few parts, so I figure I better get this down on the blog so I can find it next time I need it. Plus, it'll probably help out a few others. Step 1: SMTP The SMTP service probably wasn't installed with IIS7. In fact, it's not even part of it anymore. You can still install it though: Go to Server Manager, select Features. If you don't have SMTP listed, click on Add Feature and you can find it in the list there and install it. Be sure to allow it to install the extras that go with it. You'll need the IIS6 manager to manage it. Step 2: Configure SMTP It's not with IIS7 management, as you would expect. Instead, once SMTP is installed, you will get a new option in your start menu, the IIS6 Manager. (Under administrative tools). Go there and you'll be able to start the SMTP service and configure it. For some reason, for hours, I couldn't get my messages to send out. Turns out, my app wasn't logging properly so I didn't have any details as to why messages weren't going. After fixing that, I was able to see the following message: 5.7.1 unable to relay for user@domain.com It turns out, SMTP doesn't allow anything to send through it by default. You can remedy this by doing the following:
  • Open the SMTP manager via the IIS6 manager
  • Right click and hit properties on the SMTP virtual server
  • Go to the Access Tab
  • Click the Relay button near the bottom
  • Add 127.0.0.1 to allow local relays, as you might do just sending email from web apps.
Bonus: SMTP Logging Another caveat when trying to debug things is that the SMTP service does not enable logging to start with. Additionally, if you turn it on, it might not even work to start with. If you enable it (under that same area, but the General Tab) and no log files get generated, you need to install ODBC Logging. To do that:
  • Go to Server Manager
  • Expand Roles on the left and select Web Server underneath
  • On the right, scroll down to Role Services, and click on Add Role Services on the right.
  • Select ODBC Logging and install it.
  • Logging should start working (you may need to restart the smtp service)
Feel free to post any additional details in the comments, or questions you may have. IIS7 setup and configuration is a rela can of worms!


Comments

Be the first to comment below.

Post Comment