Faking email delivery in .NET

Well here's a tip that would have prevented me from barraging the owners of test.com and asdf.com with mountains of garbage test emails, had I discovered it many years ago (sorry about that, guys!). In .NET you can easily specify a location to dump emails ready to be picked up by the SMTP server. If you make it a location that the SMTP server doesn't know about, then they'll sit there forever, and asdf.com can rest easy at night...

All you gots to do is add the SpecifiedPickupDirectory setting in your web.config, like so:

<system.net>
    <mailSettings>
      <smtp deliveryMethod="specifiedPickupDirectory">
        <specifiedPickupDirectory
          pickupDirectoryLocation="c:\myEmailzHerePlz"
        />
      </smtp>
    </mailSettings>
  </system.net>;

Make sure you create the directory, else it'll explode. And that's it! .eml files will start stacking up in the directory you specify, ready to be examined in your email client. Happy HTML-email testing day!