Send email from your local machine tips / tricks.

Tags: SMTP

A common question that comes up in the newsgroups is how to setup your local machine to relay email.  Windows 2000 / XP / 2003, 2008 comes with the built-in SMTP service, Vista does not provide this option.  You can install another 3rd party SMTP server to make up for this.  If you are using XP / 2000 or any Server products (2000, 2003, 2008), you can configure this by simply installing and configuring the relay option.  For Vista, you’ll need to consult the 3rd party vendor you install how to configure relay options, if applicable.  Here is a couple of posts that discuss this further. and

After you have installed the SMTP service option, open IIS Manager >> Right click properties on Default SMTP Virtual Server >> Select Access Tab >> Relay option and put  Secondly, I recommend you enable logging so when you are trying to verify things are working, you can review the logs.  Here is my blog on enable logging.  The logs are located by default in c:windowssystem32logfilessmtpsvcsmtpsvc1  To verify the service is listening.  Open up a command prompt and type netstat -an -p tcp  It should show  If you see this, you know your SMTP service is active and ready.  If this isn’t listed, you didn’t install the SMTP service properly.  I would do this after following the procedure to ensure the service is active. 

The biggest hangup most people have their ISP only allows them to route a certain number of emails or blocks port 25 all together.  You’ll want to check with your ISP or test sending emails to an external address from the machine running the SMTP service.  You can use a simple telnet test locally to an an email address such as, MSN, Gmail or another free provider.  If you receive the telnet test, you know your local SMTP server is working.  If it’s stuck in the Queue or Pickup directory, there is a problem, either your local ISP doesn’t allow relaying or something else.  This is where the logs come in handy.  Another tool for verifying your config is SMTPDiag.  Here is a post with some info how to use SMTPDiag.  You may wonder why your local ISP blocks port 25, this discourages customers from setting up their own mail server to send out emails, unsolicited email or zombie machines infected with a virus or spyware. 

This is not an exact science.   A lot of people think it is really hard to configure the mail server, it isn’t the too bad.  It is understanding there are external factors like the ISP not allowing the operation in the first place or DNS not configured properly.  The DNS is another common mis-configuration, but if your machine is connected to the internet through a router or other machines, most likely the telnet test or simple email test will resolve the MX (mail exchanger) records.  SMTPDiag will help out here.  This posting is not intended to teach how email works, but hopefully you get the idea. 

So the final question, how do I verify my port 25 is open?  You can either send a telnet test or find an external port scanner that will scan your IP address.  If your machine is listening on port 25, you’ll see the port open in the results.  Most people are running a local firewall that will block the scan or a router such as linksys.  You can temporarily unblock port 25 on both your router and your local firewall so the scan will determine if port 25 is open.  If your ISP is blocking it, port 25 will not show up in the results.  At least by you unblocking the two common points you control, this can help isolate the ISP issue.  When you are done with the external port scanner, remember to enable these options again on the router and / or your local firewalll so you’ll not be potentially scanned by bots looking for rouge mail relay servers.

If you have other thoughts or experiences, please share them.  I hope this post helps you in your quest to get the mail server working, so you can send email from a 3rd party program, your ASP / ASP.NET application or some other program.


Steve Schofield
Microsoft MVP – IIS