Today I got a case where I was asked for a script to configure SMTP programmatically in IIS 7.
To be precise requirement was to check [corresponding setting on IIS 7] for the “All except the list below” check box and add the IP’s to the Deny List programmatically .

image

Some of the interesting facts regarding SMTP on IIS 7:

  • You can install SMTP SERVER on windows 2008 and not on windows 7/Vista.
  • By default SMTP server is not installed on win 2008.
  • It is dependant on Metabase Compatibility components
    • Internet Information Services –> Web Management Tools –>  IIS 6.0 Management Capability Feature
      Server manager ==> Features ==> ADD Feature -> Remote Server Administration Tools ==> Web Server (IIS) Tools
      Web Server (IIS) Tools includes the Internet Information Services (IIS) 6.0 Manager and IIS Manager snap-ins.

image

Click Next ==> Install for installation to succeed. Now opening IIS 7 manager UI you won’t be able to find anything related to SMTP server apart from SMTP email setting. Strange isn’t it.

Well  you have to go to start ==> run ==> inetmgr6 [This would open up old IIS6 snapin)

image

My colleague Vijaysk has already written script for it . Download it from here

I have added 127.0.0.1,255.255.255.255 into ip.txt [ which need to be put into Deny List]

image

Checking in the IIS6 [inetmgr6] console on window 2008 :

image

Great !