129

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?

Patrick McElhaney
  • 52,844
  • 37
  • 123
  • 157
  • 42
    @casperOne Why close this question three and half years later? It's a straightforward problem with a handful of useful solutions. There hasn't been any debate, polling or extended discussion. If this page were to disappear from Google search results, would it make the internet better? – Patrick McElhaney Nov 20 '12 at 14:40
  • 1
    It's a shopping list/product recommendation question (and also inherently subjective and open ended: "how do you test sending email"), none of which are good fits for the site anymore. – casperOne Nov 20 '12 at 14:48
  • 3
    @casperOne Then rephrase the question so it's not as subjective. I wasn't look for the best product in category X. I was asking whether category X exists. Anyway, you haven't answered my question. Convince me that removing this page would make the internet better, and I'll delete it myself. – Patrick McElhaney Nov 20 '12 at 15:07
  • 1
    All due respect, my *primary* responsibility isn't to do this. Given that it's *your* question, you're more than welcome to perform the edits (as long as they don't invalidate the existing answers) and flag for moderator attention asking for it to be reopened. Or you could post on [Meta] and get the community's opinion on this. – casperOne Nov 20 '12 at 15:09
  • 1
    My personal opinion, yes, it would make Stack Overflow better if this was deleted. This kind of post is one that is better suited for a blog post. The Q&A engine of Stack Overflow is not well suited for this kind of question as it attracts spammy, low-quality, link-only answers. These questions also typically fail to be maintained properly over the course of time. – casperOne Nov 20 '12 at 15:12
  • 1
    @casperOne Fair enough. I asked you because I wanted to understand your reasoning. Thanks for all you do as a moderator and taking time to respond to my comment. – Patrick McElhaney Nov 20 '12 at 15:22
  • NP, and thanks for the understanding and the appreciation. They're appreciated. – casperOne Nov 20 '12 at 15:23
  • 1
    I stumbled across this question during my research and eventually wrote my own software to do just this: https://github.com/yankee42/developmentSMTP – yankee Nov 28 '12 at 14:04
  • 12
    @casperOne I came across this question from Google inquiring of the Windows based options (as opposed to the Linux options I had previous exposure to). I found *all* the links helpful. This web page will be sorely missed. – justin.lovell Jan 03 '13 at 07:22
  • 5
    Well, i just was looking for a windows mail server tool which just takes the mails from localhost and i found it simple and easy by this question. The upvoted answer is all most people are looking for so i cannot see why you want to close this as it does what the majority of people expects. – sveri Apr 05 '13 at 15:19
  • 1
    I see a lot of questions like this being closed, and I understand why. They tend to be messy and tend to get out of date; the problem being that the best answer can change over time. The fact is, though, that this page seems to be the highest quality page for this question that I can find. It's messy, but it's definitely useful. So, the question I have is, is there a better place for questions like this other than StackOverflow? – David Hammond Apr 19 '13 at 15:55
  • @sveri Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it. – AStopher Jun 05 '15 at 07:47

9 Answers9

84

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.

Patrick McElhaney
  • 52,844
  • 37
  • 123
  • 157
rnwood
  • 1,469
  • 10
  • 12
  • +1 A little buggy but overrall does what its needed for. Thanks! – David May 07 '10 at 17:37
  • 4
    Nice when it works but very crash-prone. – olefevre Mar 07 '11 at 05:44
  • This looks like a brilliant app, unfortunately it crashes for me every time a mail is received (running smtp4dev on win7, sending from SQL Server Database Mail Test E-mail script) – Jona Dec 06 '11 at 13:17
  • Just downloaded this to test code sending email through sharepoint. I didn't have SMTP installed on my virtual so this app worked like a charm. Kudos! – Ryan Dec 30 '11 at 00:39
  • Amazing thing, really useful! Thanks! Have you considered writing a separate smtp server running in the background and only sending emails without a GUI? – Pavlo Dyban Oct 12 '12 at 08:25
  • 2
    For what it's worth, on Windows 7 - 64 Bit, smtp4dev would not work but http://papercut.codeplex.com/ did. The mails were being generated using JavaMail. – Ashutosh Jindal Oct 24 '12 at 08:35
  • according to this link http://smtp4dev.codeplex.com/workitem/5570 a "MSIL/Injector.AN Trojan" virus was found in that code. – Tristan Descartes Nov 18 '14 at 19:52
  • Loved smtp4dev! On an ubuntu machine now and not sure what would be the linux alternative to this?I have found another windows alternative to smtp4dev called Papercut http://papercut.codeplex.com/ if anyone is interested. – thorne51 Mar 26 '15 at 08:55
73

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.

Dylan Beattie
  • 50,029
  • 31
  • 120
  • 189
Joop
  • 2,778
  • 2
  • 17
  • 26
  • 3
    Awesome, zero install... works great for me. Thanks! – WildJoe Jan 23 '11 at 01:32
  • I'm using SmtpClient in a .Net web application with a specific smtp host set at compile time. I'm not seeing any change in behavior based on adding this to the end of my web.config. –  Sep 13 '12 at 18:25
  • 4
    Aha! Throws an exception unless you create the folder before hand. Nice trick! –  Sep 13 '12 at 19:11
  • 1
    Awesome little trick with zero install. – Mike Kruger Feb 26 '13 at 23:14
  • We had the same problem when working with a .NET stack - we ended up building [this service](https://clickityapp.com) to solve the issue – isNaN1247 Apr 27 '13 at 07:02
18

There is now a web based version of Papercut.

Also the app based version works fine for me.

Steve
  • 8,541
  • 5
  • 39
  • 60
Adam Seabridge
  • 1,711
  • 17
  • 24
14

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.

Rob
  • 13,342
  • 26
  • 40
  • 60
Fredou
  • 18,946
  • 9
  • 53
  • 107
9

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

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

txyoji
  • 6,272
  • 1
  • 40
  • 44
  • on mac, to use port 25, run the following command in terminal, in the same dir as the file you download: `sudo java -jar DevNullSmtp.jar` – Brad Parks Apr 28 '13 at 00:28
6

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

Alix Axel
  • 141,486
  • 84
  • 375
  • 483
6

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.

Adrian Clark
  • 12,189
  • 5
  • 32
  • 41
5

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.

Persimmonium
  • 15,150
  • 11
  • 43
  • 76
3

You can also use netDumbster.

http://netdumbster.codeplex.com/

Carlos Mendible
  • 291
  • 1
  • 8