Posts Tagged ‘testing’

Test mail send routine without mail server

I picked up a blog post about this tip from one of my RSS feeds. Amr ElGarhy posted a valuable article on how to write emails to a local directory rather than sending them through a mail server. This saves a lot of time in dev.

Essentially, replace your existing mail configuration with the config below:

<system.net>

<mailSettings>

   <smtp deliveryMethod=”SpecifiedPickupDirectory“>

    <specifiedPickupDirectory pickupDirectoryLocation=”c:\tmp” />

   </smtp>

</mailSettings>

</system.net>


When you send a mail using the built in .NET classes, a *.eml file will be created in the directory you specify. You can then view the email by simply opening the file.