Eggins.com
Powershell, .Net, Visual Studio, Team Foundation Server, Windows Communication Foundation

IIS SMTP Settings

You can set up  your application to send emails using the System.Web.Mail.SmtpMail class. You must supply the name or IP address of your SMTP mail server or relay using the SmtpServer property:

SmtpMail.SmtpServer = "MyMailServer"

If you want to keep a record of the email sent using your application, you can set up the SMTP component of IIS on your Windows OS and have it relay the email to your mail server. This allows you to look at the SMTP log in IIS, so help with testing and determining problems. To set this up:

 

  1. Install the SMTO component of IIS using Add Remove windows components
  2. Start the SMTP component of IIS using the IIS configuration application
  3. Enable logging for the Default SMTP Virtual Server under the general tab
  4. Set the logging to include all of the extended properties you wish to log using the Advanced button. By default it is pretty minimal
  5. Set the smart host to your SMTP server by clicking the Advanced button on the Delivery tab.
  6. By default, yor application cannot use the local SMTP server to relay emails. You can click the Relay button on the Access tab and either Select "All except the list below", or add the names of the machine(s) that are allowed to use this SMTP service as a relay. The secont option is more secure.
  7. Now you can point your software at the localhost SMTP service. SmtpMail.SmtpServer = "Localhost"

Now you can look in the following folder to see emails that are qued, bad, etc:

C:\Inetpub\mailroot

 And you can look in this folder for the log of email sent:

 C:\WINDOWS\system32\LogFiles\W3SVC1


Posted May 17 2007, 02:54 PM by David
Filed under: ,

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Copyright eggins.com, 1998 - 2008
Powered by Community Server (Non-Commercial Edition), by Telligent Systems