Papercut: A Stupidly Simple SMTP Server for Local Development

Papercut Screenshot

I've always found sending email in development to be one of the most frustrating parts of developing web applications. Some frameworks will provide a dummy SMTP server to handle this, but ASP.NET is not one of those. Sure, you could just install IIS locally and use it's SMTP functionality, but why should you have to? Visual Studio should really have this functionality out of the box.

I just stumbled upon a project on CodePlex called Papercut. It does just one thing: provides a local SMTP server and captures all email sent through it, insteading of sending it out to the actual recipients. I downloaded it and had it up and running in a matter of seconds, and more than being just functional, it actually has a rather nice WPF-based interface.

First, go to http://papercut.codeplex.com and click the ridiculously huge "Download" button. Run the downloaded file and Papercut will be installed. Now, just go into your project's Web.config in Visual Studio and add the following into the <system.net> tag.

<mailSettings>
  <smtp deliveryMethod="Network" from="[email protected]">
    <network host="127.0.0.1" port="25" />
  </smtp>
</mailSettings>

And, you're done. Send email from your application at will, and you'll get a notification almost immediately when Papercut gets it. Click on the notification or open Papercut, and you'll see the email presented much as you would in a your favorite email client, with the added ability to easily see the headers, sections and body of the message. Of course, in order for this to work, Papercut must be running, but you can set it to run on boot and to minimize by default in Papercut's options. A nice bonus is that Papercut minimizes to the system tray instead of having an always present taskbar icon.

comments powered by Disqus