Here are a few simple ways and powerful tools to test your email functionality when you are developing your awesome application.
The Case for Email Testing
After working in CRM and dealing with millions of records, and dozens of fragile’ly built systems, I have been through imagined (and a couple of real) scenarios of email fiascos -
- Sending out emails with wrong templates or to the wrong audience
- Sending emails in bulk from the wrong environment (good luck explaining that to an infuriated CTO)
- Wrong configuration that breaks tracing and you are left wondering whatever happened to the last email blast which did not record a single click
While many of the systems I deal with are on cloud and we have to figure out intelligent ways to manage emails like domain forwarding, custom whitelisting, or outright ban emails - there are many custom systems that can provide better tooling. We can do quite a lot with free, simple-to-use services that can be deployed locally on a developer machine to fast-forward development.
Here are a few tools that can help.
FakeSMTP is a simple and straightforward solution to “catch” emails locally.
Using the program is simple enough -
- Download FakeSMTP, a stand-alone
jarfile, and run it
- Start on the server (runs on default SMTP port, but is configurable)
- Start sending emails to SMTP and see the flow of emails within the FakeSMTP program. You open emails with the default mail program on your system
At 2 MB and a minimal footprint, catching mails in development does not get better than this.
Papercut has a better overall UI and pleasing functions.
You install the program and start sending emails to the port. Papercut -
- Has its own viewer that emulates common email programs to show how your email appears to end user
- Displays notifications whenever an email arrives
Papercut is a polished product with well-written documentation and is a pleasure to use.
If you don’t like either of the above options or want to see an alternative - check out SMTP4Dev.
Don’t let that name fool you - it exactly does what the name says, and does a really good job too!
SMTP4Dev is a good ‘mail catcher’ program with its own viewer, and is well suited for those apps that extensively test emails. The inbuilt viewer makes the process of manual testing fast and you can start failing those email test cases quite efficiently.
src: smtp4dev GitHub page