# Monday, March 21, 2011
« WinForm Tip: Dynamically change the font... | Main |
I was reading a book about MVC (Pro ASP.Net MVC 2 Framework) and I came across a snippet for setting up SMTP so it saves to a file instead of sending it. This is really great for testing, since many of us don't have access to the SMTP server from our development boxes. Also, it allows you to test with real data but prevents the emails form actually being sent.

But before I could write it up, I noticed another popular tech blogger posted it as well. So really this tip is for me so I will always have it when I get over to my client site.

Here's the config settings to write your email to the 'c:\email' directory.:

<system.net>

    <!--specifies to save the email into a directory instead of sending it for testing-->

    <mailSettings>

      <smtp deliveryMethod="SpecifiedPickupDirectory">

        <network host="ignored" />

        <specifiedPickupDirectory pickupDirectoryLocation="c:\email"/>

      </smtp>

    </mailSettings>

  </system.net>


Comments are closed.