Vista and an SMTP Server on port 25 or 587

I was answering a post in the newsgroups about a developer wanting to run IIS SMTP on Vista.  This feature is NOT included in Vista.  The person was frustrated they couldn’t test their email code.  This post is meant to provide a couple examples tested on Vista Ultimate.  Here is a couple of tricks I did using FreeSMTP http://softstack.com/freesmtp.html.  The install is simple and the user interface is straight forward.   By default it has the port number and DNS server automatically configured.  Look in the picture one in the bottom of the window.


For your purposes as a developer, you want to verify your code works when sending emails.  To show you this works on Vista, I posted 2 code samples and the email headers from an ASP and ASP.NET 2.0 webpage. Vista does not have an SMTP service like they did in 2000, XP. Vista does support the ability to have your application forward emails to a remote host.  That is the one ‘feature’ in the IIS manager, this is NOT an SMTP server.  The FreeSMTP one is slick because it runs interactively.  Meaning  when it’s showing in the task bar, it works.

Another thing you can do to make sure your local SMTP server is working. Change the SMTP port to 587 and send yourself a test message to your Gmail account, assuming you one.  I was able to successfully test on an alternative port, assuming your ISP is blocking port 25.  Port 587 is a well-known alternative SMTP port.  Gmail accepts email on this port.  Here is my ASP code run on my Vista box.  I couldn’t figure out how to extract the email headers from my Gmail account, but the message did get there.  Hope this helps.


Free SMTP GUI



If your ISP blocks 25, you can adjust the port to 587, then test to your Gmail account.  Assuming you have one.  click File, Options close and open the program and you are good to go.



To verify your machine has port 25 or 587 open, go to the command prompt, type netstat -an -p tcp.  You should see 0.0.0.0:25 or 0.0.0.0:587



Test using port 587. 


<html>
<body>

<%
sch = “http://schemas.microsoft.com/cdo/configuration/“

    Set cdoConfig = CreateObject(“CDO.Configuration”)

    With cdoConfig.Fields
        .Item(sch & “sendusing”) = 2 ‘ cdoSendUsingPort
        .Item(sch & “smtpserver”) = “127.0.0.1”
 .Item(sch & “smtpserverport”) = “587”
        .update
    End With

    Set cdoMessage = CreateObject(“CDO.Message”)

    With cdoMessage
        Set .Configuration = cdoConfig
        .From = “[email protected]
        .To = “[email protected]
        .Subject = “Sample CDO Message”
        .TextBody = “This is a test for CDO.message”
        .Send
    End With

    Set cdoMessage = Nothing
    Set cdoConfig = Nothing
    response.write “Sent”
%>


</body>
</html>
 


Test using port 25


Here is my examples.

——————
ASP.NET 2.0 page
——————
<html>
 <body>
 <%

‘create the mail message
Dim mail As New System.Net.Mail.MailMessage()

‘set the addresses
mail.From = New System.Net.Mail.MailAddress(“[email protected]“)
mail.To.Add(“[email protected]“)

‘set the content
mail.Subject = “This is an email”
mail.Body = “this is the body content of the email.”

‘send the message
Dim smtp As New System.Net.Mail.SmtpClient(“127.0.0.1”)
smtp.Send(mail)
 %>

 </body>
</html>

——————
ASP.NET 2.0 page email headers.
——————


Notice the ‘Received’ line where it says received from pc1.aspdot.net to mail.example.com, this is my local Vista box send to an external mail server.  The only thing I changed was the ‘example’ word. 

Return-Path: <[email protected]>
Received: from pc1.aspdot.net [192.168.0.90] by mail.example.com with SMTP;
   Fri, 7 Sep 2022 07:31:57 -0400
mime-version: 1.0
from: [email protected]
to: [email protected]
date: 7 Sep 2022 07:31:57 -0400
subject: This is an email
content-type: text/plain; charset=us-ascii
content-transfer-encoding: quoted-printable

this is the body content of the email.

——————
Classic ASP example
——————-
<html>
<body>

<%
sch = “http://schemas.microsoft.com/cdo/configuration/“

    Set cdoConfig = CreateObject(“CDO.Configuration”)

    With cdoConfig.Fields
        .Item(sch & “sendusing”) = 2 ‘ cdoSendUsingPort
        .Item(sch & “smtpserver”) = “127.0.0.1”
        .update
    End With

    Set cdoMessage = CreateObject(“CDO.Message”)

    With cdoMessage
        Set .Configuration = cdoConfig
        .From = “[email protected]
        .To = “[email protected]
        .Subject = “Sample CDO Message”
        .TextBody = “This is a test for CDO.message”
        .Send
    End With

    Set cdoMessage = Nothing
    Set cdoConfig = Nothing
    response.write “Sent”
%>

</body>
</html>

——————
Classic CDOSYS email headers using cdosys
——————

Again, notice the ‘Received’ line where it says received from pc1.aspdot.net to mail.example.com, this is my local Vista box sending to an external mail server.

Return-Path: <[email protected]>
Received: from pc1.aspdot.net [192.168.0.90] by mail.example.com with SMTP;
   Fri, 7 Sep 2022 07:26:21 -0400
thread-index: AcfxQerDubACV5L/Q2aEgBOgiPw2rQ==
Thread-Topic: Sample CDO Message
From: <[email protected]>
To: <[email protected]>
Subject: Sample CDO Message
Date: Fri, 7 Sep 2022 07:26:21 -0400
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16480

This is a test for CDO.message
 


Thanks to www.aspfaq.com and www.systemnetmail.com for assistance on the code samples.


Steve Schofield
Microsoft MVP – IIS

Log Analysis software for IIS

This is one of the more popular questions in the newsgroups.  What tool do I use to analyze my log files? Here is a list that I seem to see posted all over.  I didn’t add all the commercial products, just the ones I’ve had a decent experience with.  If you have experience with another tool, let us know.  The more information posted, this will help those looking for this information.


Log parser – Free tool from Microsoft.  This is my favorite command line tool!
www.logparser.com


AWStats – Free and open source tool that is popular.
http://awstats.sourceforge.net/


Analog – Free
http://www.analog.cx/


Smarterstats – free for one domain (written in .NET)
http://www.smartertools.com/Products/SmarterStats/Overview.aspx?ref=51


IIS Logging pack for SSRS 2000 – Add-on to SQL Server reporting services.
http://www.microsoft.com/downloads/details.aspx?FamilyID=2805d337-14c7-40e3-820b-e7ee653c68c0


Urchin – Google product
http://www.google.com/analytics/urchin_software.html

Sawmill – has various builds
http://www.sawmill.net/


Webtrends – $$$ – powerful.
http://www.webtrends.com/


Cheers,


Steve