Dummy SMTP server for development purposes [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this questionI'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 w开发者_运维问答indows batch file and possibly even query the emails from my unit/functional tests.
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
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.
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
精彩评论