Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Some applications generate emails. There may be multiple email formats based on the purpose of the message. The email may be destined for a single individual or a group. It may also be locale-dependent.

What are some useful techniques for automating testing emails?

share|improve this question
up vote 3 down vote accepted

My preference is to have our email administrator create some 'public folders' for the QA team and tie them to a small handful of email addresses. That way everyone on the team has access to the received mails. If needed you can look at the header details of a message to be sure exactly what 'friendly name' it was sent to. It means mail sent to a large number of virtual 'people' in the system end up in a small number of folders, which makes it easy to see who got mail when without having to patrol a large number of email accounts.

Doesnt work so well for systems that require each email address to be unique however. In that case you may have to setup a large number of test accounts. You can get however much the same effect by having each one setup with a forward and delete rule that then routes those mails to a central clearinghouse, perhaps with a brief header saying 'mail recived for...' being added in. That still gives you one place to check for the mail (provided the forwarding rules run on the server and not on the client)

share|improve this answer
"Doesnt work so well for systems that require each email address to be unique however. In that case you may have to setup a large number of test accounts." Sometimes, you can create "unique" email addresses by appending a suffix to a single address. For example is different from But Gmail will deliver both to Try it with your own gmail account! – Joe Strazzere Jun 23 '11 at 11:11
I'd known that caps made no difference and periods pretty much didn't exist in gmail addresses (johnsmith is the same as John.Smith) but of course that has a limited number of variations. The numeric suffix is a good trick, I wonder if systems like exchange can be setup to allow that – Chuck van der Linden Jun 23 '11 at 18:15

You can give Dumbster a try.

Dumbster is a very simple fake SMTP server designed for unit and system testing applications that send email messages. It responds to all standard SMTP commands but does not deliver messages to the user. The messages are stored within the Dumbster for later extraction and verification.

Its written in java and is open-source.

share|improve this answer
Is there something like the dumpster for exchange email generation? Also is there support for testing Attachments? Lastly can I get it all for .net ;-) ? – Squirrel Jul 9 '11 at 6:09

Also you may try Mailtrap if you don't want to set up and launch SMTP server locally. It is free web server that provides its own SMTP for e-mail messages debugging and testing.

share|improve this answer
+1 for relevant solution and welcome to SQA, Alexander! Note that according to FAQ you must disclose your affiliation in the answer if you describe your product – dzieciou Nov 3 '12 at 19:14

If all you are interesting in is catching all the emails sent from an application then SMTP4DEV is a great little tool.

share|improve this answer

In addition to the fine approaches mentioned earlier, I have had success using a fake SMTP client that writes emails to a file system. Each message was written to a separate file in a directory named after the recipient. The file system approach had the advantage of simplicity; there was no SMTP server -- fake or otherwise -- to configure.

Our product generated emails from templates. It was important to ensure that the templating system worked correctly, but it was also important to ensure that the application supplied the correct data to fill into the templates. Testing the latter became a parsing problem. I ended up replacing our standard templates with simple ones that produced property files. So for example instead of generating this:

Dear Joe Doe,

Your current account balance is $125.

JP Morgan Bank

we would generate this:

RecipientFirstName: John
RecipientLastName: Doe
CurrentBalance: 125.00
SenderBank: JP Morgan Bank

This way, it was easy to parse the generated emails.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.