94

When I'm developing something that sends email, I sometimes don't want to actually send any email, but I do want to see what email would be sent using live data. However, there's not an easy way to do this, as I haven't found a local SMTP server that will receive my mail and then just hold it for me in a queue so I can view it.

In Windows XP and Vista, I used the locally installed SMTP server and just set it to deliver to a smart host that didn't exist - the mail just sat in the "inetput\mailroot\queue" folder forever, and I could view it whenever I wanted to. However, in Windows 7, there's no longer an integrated SMTP server, and though I've found a number of SMTP servers that can be installed locally and relay mail for me, I want one that won't relay mail.

Does anybody have suggestions on how to accomplish this functionality? I've considered writing my own, but implementing the whole RFC spec seemed like a big task if there's something out there. Maybe there's an open-source project that I could modify just to write the mail to disk instead of delivering it.

SqlRyan
  • 33,116
  • 33
  • 114
  • 199
  • Mailnest.io is an affordable solution as it helps in collaboration between teams or it has a free plan if your usage is less. – Anish John Aug 10 '20 at 10:45
  • For testing purpose [fake-smtp-server](https://www.npmjs.com/package/fake-smtp-server) is very useful. One line command to start the server `fake-smtp-server [OPTIONS] [ARGS]` – Gagan Dec 17 '21 at 16:54

4 Answers4

181

Papercut is likely what you want, though it is only compatible with Windows.

Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
driis
  • 161,458
  • 45
  • 265
  • 341
  • 8
    That couldn't be more what was I was looking for if I'd written the spec myself - thanks for the tip! – SqlRyan Nov 15 '10 at 03:07
  • 3
    How to use it? I don't get it. – emeraldhieu Sep 24 '13 at 04:11
  • 2
    @Emerald214: Download the application and run it. It will set up an SMTP server when it's running. Configure your application to use 'localhost' (or the machine where the server is running) as the SMTP server. If you need to use a non-default port number, you can configure it in Options. – RMorrisey Jun 18 '14 at 21:11
  • Can't begin to tally the hours i've wasted trying to setup relays with my personal gmail account. This is the solution and I wish it were better known. Thank you driis!! – Mr Griever Aug 28 '14 at 19:15
  • 3
    Umm, what about non-Windows environments? – Brade Nov 12 '14 at 21:11
  • 1
    @Brade, first google hit: http://nilhcem.github.io/FakeSMTP/ – driis Nov 13 '14 at 20:18
  • Thank you for this suggestion! I wanted to test email notifications sent by JIRA! This did the trick for me! – Ashish Goyal Jan 02 '16 at 21:47
  • 1
    To clarify the above, use Host: localhost, Port: 25 (default that can be changed) – Savage Aug 22 '16 at 16:10
  • Simple, but very useful tool. Just be aware that a) the GUI client tends to crash in my UAT-VM because the environment can't access the Internet, and the first sample email automatically generated includes external resources (you can delete the mail file from the "Incoming" folder), and b) if you copy the unzipped files to, say, "C:\Program Files" and run from there, you'll need to run the program as admin or it won't be able to do things like delete its emails. – Amos M. Carpenter May 09 '17 at 01:28
  • smtp4dev - windows only - http://www.softpedia.com/get/Internet/Servers/E-mail-Servers/smtp4dev.shtml – xhafan Jun 06 '18 at 11:56
  • I SO love both this question and this answer... I always forget the name of this great solution. Thanks for having it here. Do understand why the Stack thinks this is not a good question. – GerardV Jan 20 '21 at 13:07
12

Another local test SMTP server application: https://nilhcem.github.io/FakeSMTP/

LM.Croisez
  • 484
  • 4
  • 10
3

Awesome, free, cross-platform, and even runs well in a VM environment like Vagrant: http://mailcatcher.me/

Brade
  • 1,481
  • 1
  • 13
  • 21
2

You may want to look at NDdumbster

Pawel Lesnikowski
  • 6,264
  • 4
  • 38
  • 42