59

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

3

10 Answers 10

72

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

4
  • I take it back, it does support HTML emails.
    – HTTP500
    Feb 9, 2012 at 17:32
  • 3
    still the best way to debug!
    – MarZab
    Apr 26, 2015 at 19:32
  • 1
    No support for starttls :(
    – Att Righ
    Sep 3, 2017 at 15:54
  • 1
    @AttRigh the smtplib has TLS implemented but using that isn't going to be as simple as this. Post the question; maybe someone has a script already?
    – John Mee
    Sep 4, 2017 at 6:00
13

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

1
  • Thanks mailq. This is more or less exactly what I was after!
    – richo
    Apr 14, 2011 at 0:18
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

1
  • 1
    We currently use mailcatcher, crashes too much. Sep 14, 2015 at 13:58
7

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
3
  • This is great and much more robust than what I was doing! Thanks.
    – richo
    Nov 22, 2011 at 23:50
  • I like that they offer a generous free plan (for now).
    – David
    Mar 1, 2016 at 20:02
  • It doesn't work in Russia due to "digital racism", as I call it
    – Alexxus
    Aug 31, 2023 at 7:01
4

smtp4dev has worked well for me. (Windows only)

1
  • I just installed and used this awesome little tool. Perfect for my needs (no java and a nice UI)
    – Nick.Mc
    Oct 8, 2015 at 1:05
3

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.

2

http://quintanasoft.com/dumbster/

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

2
  • Too bad it requires a javavm. Plus someone has forked and worked on it more recently... github.com/rjo1970/dumbster
    – John Mee
    Mar 16, 2011 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, 2011 at 23:44
2

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

1

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

8
  • 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 1, 2010 at 1: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 1, 2010 at 1: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 1, 2010 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 1, 2010 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 2, 2010 at 3:09
0

Fake SMTP servers come in two flavours: those you install locally, and those you access as a web service ("SaaS"). Here is an overview of the latter:

  • WPOven Free SMTP Server for Testing. Different from many local and online fake SMTP servers, this one includes a fake SMTP authentication mechanism. It accepts any username / password combination, so it is not requiring your application to be able to send e-mails without authentication. Free.

  • SMTP Bucket. Functionality just as with the WPOven service, plus API interface, minus the dummy authentication mechanism. Free, with a donation option.

  • Mailspons. Commercial, with a generous free plan with 750 e-mails per month.

  • Mailtrap. Commercial, with a limited free plan with 100 e-mails per month.

  • Mailosaur. Commercial, with a free trial but no free plan.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .