Send email from your local machine tips / tricks.

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

10 thoughts on “Send email from your local machine tips / tricks.

  1. http://

    I am one of the newbies who really can benefit from this article! One thing I have not seen covered much is the problem I am running into.

    I setup Windows Server 2003 in our small office, for file and print sharing and a little sharepoint. We already have pop email, outgoing smtp, etc. through godaddy who hosts our website, and hence we all have outlook setup to connect to the godaddy SMTP server, authenticate to it over some port (different from 25), etc.

    Now I am trying to get sharepoint setup so that it can send out emails too. I’d like to configure sharepoint the same way I configure Outlook: give it my SMTP server, port, and authentication information. But as hard as I look, I can’t figure out how I am supposed to do this. Apps like sharepoint don’t seem to provide any place to enter things like SMTP authentication. All the guides out there say I should just install IIS SMTP but then the ISP for our small office blocks port 25 for certain. (it’s one of those “executive office space” deals)

    So after two days of trying, I’m basically ready to give up because sharepoint, windows server 2003 etc. seem less flexible in offering email delivery options than Microsoft Outlook is.

    Any help would be appreciated! I -know- it’s something simple but for the life of me, I just can’t figure out what it is.

  2. steve schofield

    You would need to enable the smarthost option in the IIS SMTP service. The reason GoDaddy works for your client is you are using SMTP authentication. Send a client email through another server is different than having a server with Sharepoint relay email. Sharepoint will use the built-in SMTP service feature with the OS.

    If they can setup on their end to accept email from your server, then you’ll be able to relay email from your server..

  3. http://

    My application runs as window service on 2000 server for years to send mail every day. Now it was moved to a new 2003 server, but it was failed to send mail with error “Could not access ‘CDO.Message’ object.”. On new server, it runs fine as console application.

    On 2000 server, SMTP service was installed, but disabled. No logfiles for smtpsvc was located. So the IIS is not installed on new server. What is requirement for system setting to make system.web.mail work in my case? Thanks.

  4. steve schofield


    Please post your question on with a sample set of code. Here is what I found on google.

  5. http://

    I have looked that site and posted my question on.

    I found another post at…/error-when-trying-to-send-email-from.html, which described the same problem I had. I created additional thread to handle sendmail and got same error.

    The code is standard and very simple. It should be fine because it was running for years on old server and can run as console on new server. I have used “telnet mailserver 25” to do a simple telnet test as well. By the way, I tried sendmail application on another 2003 server and got same error.

    As I mentioned in previous mail, the SMTP service option disabled on old server. Do we have to install the SMTP service option to make system.web.mail.send run? If not, what kind of system setting should be done on 2003 server which has the built-in SMTP service feature with? Is it related with IIS or CDOSYS.dll only? Thanks.


  6. http://


    I’m trying to send an email message from a .NET program using ms-outlook but get a message from ms-outlook saying “A program is trying to automatically send e-mail on your behalf. Do you want to allow this?” and waits to choose Yes/No.

    Does anybody knows how to avoid this message?

    Panicos Frangeskos

Comments are closed.