ScioSoft's Community Blogs Optimized IT musings for the technically inclined

Test sending email on Localhost in ASP.NET: The SMTP server alternative

by James Fielding 4. March 2010 09:43

Out of the box, Visual Studio is a wonderful environment for creating and testing ASP.NET applications. This includes Microsoft's free Express Edition, which is, as some of you know, a great place to start building sites. One thing that can be challenge to test are a site's email related subroutines. A standard and effective approach is to configure the SMTP server on your test machine. Unfortunately, if you send a project to somebody that doesn't have the identical SMTP test environment set up (which is pretty much never), you're going to have problems.

If you only need to test that your project can create an email, an alternative is to use the Specified Pickup Directory method, which simply has your test environment save the email, instead of actually sending it. To accomplish this, you need to add or replace the default mail settings in your project's web.config file:

            <smtp deliveryMethod="SpecifiedPickupDirectory">
                <specifiedPickupDirectory pickupDirectoryLocation="c:\Temp\" />

As you can probably guess, you can change the pickup directory for your email to anything you want, but take note: The directory has to exist, otherwise you'll get an error. This is particularly important if you are sending your project to somebody else, and don't want them to be stuck debugging your application. So, the temp folder is actually a decent place to store and access test emails.

The great thing about using the Specified Pickup Directory method is that you can use your production email settings throughout the project, and simply swap out the web.config mailSettings when your done testing. You can also send your email enabled projects to somebody else and have it work as expected.

Specified Pickup Directory is not a silver bullet, because sometimes you actually do want to do a test send, as opposed to just saving the email. However for most situations, particularly preliminary testing, this method will probably fit your needs.

Happy emailing,
James Fielding

kick it on
Shout it

Sciosoft Systems is a Canadian web design & development company based in Muskoka, which is in central Ontario. We provide ASP.NET website & Windows Server application development services to small and medium-sized business, as well as local government and not-for-profit groups. If you have a website project you’d like to discuss, please visit us at

Share |

Tags: , , , , , , ,

Web Development | ASP.NET

Comments (6) -

ScioJim Canada
3/9/2010 2:21:58 PM #

This is going to be controversial, particularly for a couple of my friends that are SEO fanatics, but in my experience, modern search engines are pretty smart, and they get smarter by the day. I wouldn’t worry too much about messing up your page ranking by adjusting your page design/theme. If you’ve got unique and well-written content, then Google, and more importantly humans, will find you. Obviously, you want to keep the HTML clean and well-formatted, but if you’re giving a few hours of your life to each post, my feeling is that your site might as well have the look you want. I say have fun experimenting.

If you really need help, use the contact form at to contact me directly, and I’ll see if I can help you out.


stock broker
stock broker United States
3/16/2010 11:18:39 PM #

I'm curious what CMS your site uses? It looks really good and I like all the visitor functions that are available. Sorry if this is the wrong place to ask this but I wasn't sure how to contact you - thanks.

ScioJim Canada
3/16/2010 11:30:00 PM #

We use BlogEngine.Net for our blog. It's a great platform. You can find a link to it in the "Disclaimer" tab to the right.


Gwenda Bovard
Gwenda Bovard United States
3/19/2010 2:37:25 AM #

Good day I just wanted to find out on what is the difference between blogenenigne and wordpress blogs? Is it easier to use or more efficient? I amseeing a lot of blogs powered by this software popping up lately and wondering if it is better or not? Thanks...

ScioJim Canada
3/19/2010 11:13:07 AM #

Well, Wordpress and BlogEngine.NET are both open source blog publishing applications. Both are great platforms out-of-the-box, and can also be customized according to your needs. The biggest difference is Wordpress is powered by PHP and runs on a MySQL database, whereas BlogEngine.NET uses ASP.NET and is flexible on the data backend, although most developers would tend to use MSSQL, or maybe XML on small sites.

Vini Bio
Vini Bio Italy
3/30/2010 1:34:39 AM #

Thanks for such a nice blog post....i was searching for something like that.

Pingbacks and trackbacks (169)+

Comments are closed


Comment RSS

The opinions expressed herein are the personal opinions of the contributors and do not necessarily represent the views of Sciosoft Systems Inc.