If you are developing a .NET application that sends emails then you need a way to do that without needing to actually send emails out. On Windows 7 with IIS 7 installed you can easily configure a local SMTP service that will intercept all the SMTP sessions initiated in your code and successfully emulate sending the outbound email by saving it as a text file in a folder on your local hard drive. This is extremely convenient and allows you to keep working on your code without interruption even when you are not connected to the Internet.
To achieve that just add a few lines in your application's .config file (could be web.config or app.config). Here is an example of such a configuration:
<system .net="">
<mailsettings>
<smtp deliverymethod="SpecifiedPickupDirectory">
<specifiedpickupdirectory pickupdirectorylocation="c:\smtp">
</specifiedpickupdirectory></smtp>
</mailsettings>
</system>
After adding such a configuration every time your application sends an e-mail using a .NET framework built-in SmtpClient.Send
method a new file with the .eml extension will appear in the configured folder.
You can open a file with any text editor like Notepad++ for example or you can use this free EML Viewer to improve viewing experience.
No comments:
Post a Comment