57

I'm looking for an smtp service that essentially obeys the RFC, except rather than sending mail it simply logs to a file

[date] sent mail to <address>

Or whatever. I can bash this together with the bare minimum of functionality I need in python in about half an hour I reckon but if there's an existing project that works better I'd rather use that.

The reason for needing it is debugging an app that keeps sending 7* the amount of mail it's supposed to.

EDIT: And already asked: https://stackoverflow.com/questions/1006650/dummy-smtp-server-for-testing-apps-that-send-email

richo
  • 938
  • 1
  • 7
  • 16

9 Answers9

69

If you have python lying around this will write the SMTP conversation to stdout.

sudo python -m smtpd -n -c DebuggingServer localhost:25

http://docs.python.org/library/smtpd.html#debuggingserver-objects

John Mee
  • 2,298
  • 1
  • 23
  • 27
12

You should have a look at smtp-sink which is a part of Postfix. You don't have to run Postfix to make it work. Just install it to have the executable. Everything you need can be configured via command line parameters:

http://www.postfix.org/smtp-sink.1.html

Skyhawk
  • 14,149
  • 3
  • 52
  • 95
mailq
  • 16,882
  • 2
  • 36
  • 66
10

There is also a ruby gem called mailcatcher.

You can read the emails directly in your browser through the integrated web interface, there's a screenshot from their homepage below.

Mailcatcher interface

David Costa
  • 628
  • 5
  • 21
6

We use http://mailtrap.io web service in developement and staging environment. It is platform-independent and doesn't require you to run your own SMTP.

It offers:

  • All emails in one place
  • Shared access for dev team to the inbox
  • Developer tools to analyze emails
  • Flexible configuration
Bogdan Gusiev
  • 513
  • 2
  • 6
  • 9
4

smtp4dev has worked well for me. (Windows only)

Ferruccio
  • 2,583
  • 2
  • 19
  • 10
2

http://quintanasoft.com/dumbster/

This looks like a it'll probably do the job, for anyone else who stumbles upon this.

richo
  • 938
  • 1
  • 7
  • 16
  • Too bad it requires a javavm. Plus someone has forked and worked on it more recently... https://github.com/rjo1970/dumbster – John Mee Mar 16 '11 at 23:32
  • Cheers John. Java based was enough to put me off in the end, I wound up just writing something myself. – richo Mar 17 '11 at 23:44
2

Disclaimer: This is a late answer, but I genuinely believe it will help out future viewers. Also note that I worked on this product.

We built Mailosaur in order to solve this exact problem. We've since built it out to add test email addresses as well as SMTP.

isNaN1247
  • 1,615
  • 3
  • 15
  • 20
2

FakeSMTP https://nilhcem.github.io/FakeSMTP/ is cross-platform and open-source.

kervin
  • 211
  • 2
  • 7
1

I just fork up just about any smtp service then send the result to a bit bucket!

tony roth
  • 3,844
  • 17
  • 14
  • I'm talking about bulk emails though, and with live customer data involved. I need to be positive that I'm not going to flood the intertrons with mail. – richo Dec 01 '10 at 01:00
  • I wound up extending python's smtpd.SMTPServer class, I'll release the project publically in a week or so when I'm happy with it (I'm bundling it with an httpd test suite I wrote a while back). I've tentatively named the suite sdb. – richo Dec 01 '10 at 01:01
  • @Richo: there are lots of ways to stop a SMTP server from sending emails - most allow you turn off outgoing connections or reroute all messages, or you can block outgoing connections to port 25....nobody would bother writing a dummy mailserver whwn its trivial to configure a real one to behave in this way. – symcbean Dec 01 '10 at 10:41
  • @symcbean: those are all valid points. Personally I find it easier to stop my usual mail service, start my debugging service, do my debugging and then fire up the live environment again. Kludges like dumping all port 25 traffic then prevents anything else from sending mail. Thanks for the help though, – richo Dec 01 '10 at 22:40
  • none of this makes sense, all smtp gateways will give you this exact functionality without losing any of the outbound live emails! – tony roth Dec 02 '10 at 03:09
  • Tony: The point is not to send outbound emails.. – richo Dec 02 '10 at 03:27
  • duh I know that, your request is now making more sense its the fact that you want one persons (an automated process) email to be logged but not sent correct? And all other email to flow normally, correct? – tony roth Dec 02 '10 at 16:39
  • Not necessarily. I don't need to run it on a production server, so running something on port 25 that dumps all mail is not a problem. – richo Dec 05 '10 at 22:07