Fake SMTP servers for testing email sending

26th Jul 2023

Share this article:

What is a fake SMTP server?

A fake SMTP server is an email server which accepts emails sent over Simple Mail Transfer Protocol (SMTP) but doesn't actually send those emails on to the recipients. Instead, it stores the emails in the server and makes them available for viewing either visually through an app or programmatically using an API.

Why would you use one?

You will want to use a fake email server when developing or testing email flows as it will let you see that the correct emails are being sent at the right times but without the risk of actually sending a test email to a real person. You don't want to do this:

Picture of Tweet from HBO apologising for mass email

So, very useful for developers but also for testers, either internal or external, during user acceptance testing or QA. In this instance, you want to let testers use multiple (made-up) user accounts so that they can see how your software functions for different types of users. By using a fake SMTP server, you can let them use any email address for testing without introducing a risk of sending actual emails.

Finally, by using a fake SMTP server you're keeping the code the same between development and production. A fake SMTP server will allow you to simply change your app's SMTP settings without any other code changes.

What other features could my fake SMTP server provide?

SMTP is really concerned with sending of emails. Obviously, for the fake SMTP server to be useful you will need to be able to view the emails as well. Depending on the software, that may mean a desktop program, a web app or something else.

Simply seeing the emails is useful but some software comes with extra tools. For example:

  • the ability to see the different formats of the email (HTML vs plain text vs raw)
  • tools for checking the deliverability of the email, including spam scoring and SPF/DKIM checks
  • automatic link and image verification

Even if you are a solo developer, you probably have clients who will want to test the software before release. To enable that, the SMTP server should have a concept of different mailboxes so that you can have different mailboxes for different environments and users.

While visual inspection is obviously critical, it's often the case that the functionality in your software that sends emails is critical. For example, letting users sign up to the software or sending a receipt for a successful order need to continuously work. To ensure that, you will want to regression those parts of the software. Some fake SMTP servers will provide programmatic access to the emails so that you can write integration tests that involve actually sending the emails.

What options are there?

Hopefully you're convinced that using a fake SMTP server is a good idea (as opposed to real email or mocking out the email sending).

You have two options, either self-hosted or using a 3rd party service.

Self-hosted

There are several self-hosted options available. These are usually pretty good for solo development and can be fairly quick to get set up. However, as soon as you want to share previews or do user acceptance testing (not locally) you need to deploy these solutions to some server so that your testing environments can access them. At this point, you're now running a server for a piece of infrastructure that is not a key part of your software. This can be time consuming and costly.

Imitate Email

Imitate Email is a complete end-to-end sandbox email server, provided as a cloud-based SaaS. Imitate Email focuses on providing a delightful user experience for both developers and testers.

For developers, there are Chrome and Firefox extensions which, once installed, add an email viewer in to the software that your building. Using this developers stay inside the software that they're developing, seeing emails as they're sent without having to keep an eye on some other app. (You can also use the standalone web app or any 3rd party email client)

For testers, the same email viewer can be added to your apps, using Javascript and our "login-less authentication". This lets testers see the emails inside the software that they're testing without needing a log in for the fake mail server.

Finally, to round off the service, Imitate Email provides API access over standard mail protocols (SMTP, POP3 and Imap) as well as Web Socket support which enables developers/QA to write fast integration tests.

Setting up the Imitate Email fake SMTP server

1. Sign Up

First step, sign up for free from the home page or from the sign up page

All it takes is your email address or a social login like Google or GitHub. That's it!

2. Set up email sending

Once you've signed up, you'll be taken through a short onboarding process. This will:

  • Demo the embeddable email viewer
  • Show you how to send emails using either SMTP or via Email
  • Tell you how to install the Chrome or Firefox extension or proceed without them.

To see how simple getting started is, we've put together the video below. Additionally, to play around with the email viewer before signing up please see our demo

Next steps

To find out more, please check out our home page