Sending mails, development machine, without actual mail server
During development, you might prefer just to write mails to a local directory, so you can see what’s
happening without having to set up an actual mail server.
To do that open web.config and add these few lines “instead of real SMTP configurations, which you will need to activate on the real server and delete/comment these lines”:
<configuration> <system.net> <mailSettings> <smtp deliveryMethod="SpecifiedPickupDirectory"> <specifiedPickupDirectory pickupDirectoryLocation="c:\email" /> </smtp> </mailSettings> </system.net> </configuration>
This will write .eml files to the specified folder (here, c:\email), which must already exist and be
writable. If you double-click .eml files in Windows Explorer, they’ll open in Outlook Express or Windows Mail.
Tim Gaunt in his below comment mentioned about a very nice tool called smtp4dev , A Dummy SMTP server that sits in the system tray and does not deliver the received messages. Useful for testing/debugging software that generates email.
Similar Posts
- 10+ Ways for testing website browser compatibility
- Websites and Web Projects
- Deploying ajax wcf service on shared hosting.



Comments
Jake Rocheleau on on 7.20.2009 at 5:00 AM
This is great, I've got IIS set up on a laptop in my room but can never figure out how to configure an SMTP client.
TomA on on 7.21.2009 at 11:08 PM
For Django apps I have used smtp_sink.py with the same effect.
menendez.com/.../efficiently-tes
Muhammad Mosa on on 7.22.2009 at 5:46 PM
Cool tip Amr, and really nice blog you made a good job with graffiti
Justin on on 7.22.2009 at 7:57 PM
I use a free product called Papercut that acts like a local SMTP server but doesn't send out the messages.
invalidlogic.com/.../papercut
Phil on on 7.23.2009 at 1:15 AM
That's fantastic. It will no doubt come in handy for live envionments too - useful for queuing mail, logging, error handlers, you name it!
I've already added it to an email utility function which allows email to be globally disabled or put into 1 of 3 (now 4) test modes. 0 = Normal, 1 = Bcc test address, 2 = test address only only, 3 = SaveToPath, 4 = Disabled.
Thanks for the post. I wonder how many other gems like this .net has hidden away!
Tim Gaunt on on 8.03.2009 at 11:59 PM
I've used this and Papercut in the past however we're now using smtp4dev which is a step on from both as the issue we had was viewing the emails themselves.
smtp4dev can be found here: http://smtp4dev.codeplex.com/ aparently v2 is on it's way too...
Tim
Amr ElGarhy on on 8.04.2009 at 12:12 AM
@Tim Gaunt, Thanks for sharing this nice tool, will mention about in the post body, because its an important tip.
Italian Translation on on 8.08.2009 at 6:56 PM
Thnaks mate,I was looking for that info nearly 2 days.You made my mails lot easier
Kenali Dan Kunjungi Objek Wisata Di Pandeglang on on 11.03.2009 at 5:22 PM
I havent any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us.
oes tsetnoc on on 11.13.2009 at 10:02 PM
Great blog, this could be the best blog I ever visited this month. Never stop to write something useful dude!
Italian to English translation on on 5.16.2010 at 6:21 PM
That's a very neat method for sending mails without an email server,
koleksi gambar on on 7.03.2010 at 1:27 PM
nice blog,Thanks for your post
drug rehabs on on 7.07.2010 at 10:12 AM
Great read. I enjoyed reading your post and I like your take on the issue. Thanks.
Posicionamiento web on on 7.07.2010 at 11:14 PM
great post thanks