The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,842 other followers

Fake/Mock SMTP servers and services for use during development

Posted by jpluimers on 2015/02/26

When developing mail sending software, you don’t want all your test mails to proliferate in the world.

Luckily there are some SMTP servers and services that allow incoming mail, but don’t forward them:

I got two of them from the interesting Stack Overflow question How to Debug/Monitor SMTP Communications? and later I also found about development smtp server for windows.

Note that I also like smtp-cli that Tripp Lilley suggested in his answer: though not a server, it is a nice command-line tool for testing SMTP servers (for instance to see if you got the above servers/services configured right on your client side, or if you have configured your own SMTP server correctly).

The cross platform monitoring tools tcpdump and wireshark (formerly etherreal) are great tools, they are usually way too deep for most of the SMTP problems I encountered. But when the going gets tough they are invaluable, especially Wireshark as it has a great feature Following TCP streams.

I wish there were similar servers and services for POP3, that would have helped a lot with a Delphi Indy project I developed a while ago (:

–jeroen

6 Responses to “Fake/Mock SMTP servers and services for use during development”

  1. LDS said

    You can easily setup both Mercury/32 (http://www.pmail.com/) and HMailServer (www.hmailserver.com) as local mail servers to test SMTP/POP3/IMAP4 functionalities in Windows. Linux comes with its own MTA, and you can easily choose one.

    All have logs that help you to diagnose issues. Some years ago I was also using a minimal SMTP/POP3 server called something alike PostOffice, don’t remember correctly. When it comes to test this kind of software, it’s also advisable to test against some servers, because those protocols are known to be implemented often in a slightly different way.

    • jpluimers said

      I like your last tip about implementation peculiarities: I’ve bumped into those as well in a further past, so it is very worth while to test against various real server types.

  2. Kevin G. McCoy said

    I disagree. I write a lot of Delphi applications that send out email, mostly for mass-mailings of newsletters to large-membership organizations (not spam :-) ). The mechanics behind sending an email (or lots of them) is trivial. Test email accounts are easy to set up – especially if you can access the destination domain’s catch-all account. The hard part is adjusting the formatting of the email body and making sure all your macros are working properly for all possible string lengths. Sending all your messages to the bit bucket is not a good way to test. Using actual email accounts allows you to close the loop on testing by constantly monitoring what the end-user will see when the actual email goes out. Better still, write a generic library of template-driven email code that you test once to make sure the SMTP/macro-expansion part works, and then just tweak HTML template files on future projects.

    • jpluimers said

      Your presumption “Test email accounts are easy to set up – especially if you can access the destination domain’s catch-all account” was the reason for writing this post in the first place. For too many projects, getting that is hard, not so much for the SMTP part, but for getting access to those accounts beyond SMTP. Sending messages to a bucket where you can see them is a good way to test, but not the only way. Similar for sending SMS messages. Been there, done that too.

  3. Thomas_K said

    i did use “Hamster” for an Test Setup. It is written in Delphi, more info including the source code can be found here http://www.elbiah.de/hamster/pg/ in German only, In the end i was running the mail server as an Windows Service, worked just fine.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: