Send Email From Your Local Machine
by Steve Schofield
August 15, 2007
A common question that comes up in the newsgroups is how to setup your local machine
to relay email. Windows 2000 / XP / 2003 and 2008 come 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 vendor of the 3rd party component you install
to configure
relay options, if applicable. Here are a couple of posts that discuss this further:
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 127.0.0.1.
Secondly, I recommend you enable logging so when you are trying to verify things are working, you can review the logs.
Click here for my blog on enable logging.
The logs are located by default in c:\windows\system32\logfiles\smtpsvc\smtpsvc1
To verify the service is listening, open up a command prompt and type netstat -an
-p tcp It should show 0.0.0.0:25. 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
http://support.microsoft.com/kb/153119 to an email address such as yahoo.com,
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.
Click here for my post with some info how to use SMTPDiag. You may wonder
why your local ISP blocks port 25, this discourages clients 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 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 firewall, so you'll not be potentially scanned by bots looking
for rogue mail relay servers.
I hope this article 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. Cheers, Steve Schofield Microsoft MVP - IIS.
Steve Schofield is Senior Internet Support Specialist at
ORCS Web, Inc.
- a company that provides managed hosting solutions for clients who develop and deploy their applications on Microsoft Windows platforms. Services include shared hosting, dedicated hosting, and webfarm hosting, with specialty in .Net, SQL Server, and architecting highly scalable solutions.