How to develop and test an app that sends emails (without filling someone's mailbox with test data)? [closed]

StackOverflow https://stackoverflow.com/questions/1006650

Question

I have a lot of apps that send email. Sometimes it's one or two messages at a time. Sometimes it's thousands of messages.

In development, I usually test by substituting my own address for any recipient addresses. I'm sure that's what everybody else does, until they get fed up with it and find a better solution.

I was thinking about creating a dummy SMTP server that just catches the messages and dumps them in a SQLLite database, or an mbox file, or whatever.

But surely such a tool already exists? How do you test sending email?

Was it helpful?

Solution

I faced the same problem a few weeks ago and wrote this: http://smtp4dev.codeplex.com

Windows 7/Vista/XP/2003/2010 compatible dummy SMTP server. Sits in the system tray and does not deliver the received messages. The received messages can be quickly viewed, saved and the source/structure inspected. Useful for testing/debugging software that generates email.

OTHER TIPS

A few ago I came across the following solution for the .NET platform.

<system.net>
  <mailSettings>
    <smtp deliveryMethod="SpecifiedPickupDirectory">
      <specifiedPickupDirectory pickupDirectoryLocation="C:\TestMailMessages\" />
    </smtp>
  </mailSettings>
</system.net>

Simply place the above code in your App.config or Web.config. When you send a message now it will be stored as a file in the directory you provided as "pickupDirectoryLocation". Works like a charm.

There is now a web based version of Papercut.

Also the app based version works fine for me.

Dumbster might be what you want then. It's an open source fake SMTP server written in Java. It takes the place of a real SMTP server, so you can test your app in a realistic setting, without having any code stubbed out. You can make sure the right messages are sent to the SMTP server without actually delivering messages.

This is similar to the smtp4dev except implemented in java so it works for non-windows developers.

http://www.aboutmyip.com/AboutMyXApp/DevNullSmtp.jsp

There is also Papercut and Neptune, too bad none of these can be run in a portable way.

I've been using "Test Mail Server Tool" from ToolHeap for years.

http://www.toolheap.com/test-mail-server-tool/

It is a simple app that runs in your system tray and dumps emails to a folder. It can also be configured to open each email in your default mail program.

if you are using java I would use Wiser: Wiser is a simple SMTP server that you can use for unit testing applications that send mail.

You can also use netDumbster.

http://netdumbster.codeplex.com/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top