42

I've been using a dummy smtp server called DevNull SMTP so that I can test my app which sends out notification emails. It has a nice simple GUI, very helpful, but can't be scripted easily. I can't even start it listening to port 25. I have to run the app and then click on the start button...

Is there a similar app that can be scripted easily? Scripted in the sense that I can control it from a bash script or windows batch file and possibly even query the emails from my unit/functional tests.

at.
  • 50,922
  • 104
  • 292
  • 461

3 Answers3

105

there is a nice trick with python: http://muffinresearch.co.uk/archives/2010/10/15/fake-smtp-server-with-python/

Just one liner can do the job (listens on port 2500):

python -m smtpd -n -c DebuggingServer localhost:2500
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
Mic
  • 1,066
  • 1
  • 8
  • 4
3

Disclaimer - I work for the company behind this service linked to below.

You can also use a hosted email testing service like Mailosaur. Some of them (ours included) come with an API for integrating into your tests.

That way if you hit a problem you've got someone else to do the hard work in adding new features, etc. for you.

isNaN1247
  • 17,793
  • 12
  • 71
  • 118
1

I had a similar problem. Since I stumbled during my research over this question, here is what I ended up with:

For unit testing you can use subethasmtp. Base on subethasmtp I also wrote a program that you can use to call from scripts an query the results: developmentSMTP

yankee
  • 38,872
  • 15
  • 103
  • 162