Atomic Smash homepage splash

Testing WooCommerce emails with Mailtrap

Words by Adam WardSeptember 21, 2018

envelopes falling in to a mouse trap

Automated emails are great, they take all the manual work out of updating and notifying customers, setting up user accounts and resetting passwords. The only thing we need to spend time on and be sure of is the content within them! In this post, I will run through the processes and tools we use at Atomic Smash to assist us when testing WooCommerce emails and to ensure every automated email is fully tested before they are ready for the real world!

Setting the Trap

There are a few services out there that offer email capturing. At Atomic Smash we are pretty set on Mailtrap. What does it actually do? Mailtrap is a service, which offers a fake SMTP testing server for ‘trapping’ emails before they are ready for production. This helps you to isolate the testing, without the need to fill up your own, personal inboxes, or worse, accidentally sending real customers untested emails!

Before we started using Mailtrap, we used to opt for sending test emails via alias email addresses. This isn’t a great approach, as it can quickly fill your inbox up with a mix of different testing data, emails would take longer to come through and often end up in the spam folder. With Mailtrap you can set up multiple inboxes, one for each site and safely keep all of the test emails in one place.

Trapping email is very useful when you want to test out a process on your site, for example, your website’s registration process or ordering and shipping confirmation emails for e-commerce sites often result in a few automated emails being sent out to customers – such as WooCommerce.

screenshot of mailtrap admin dashboard

Mailtrap admin dashboard

This is where WooCommerce comes in!

WooCommerce comes with 11 emails out-of-the-box. The team at Automattic have done a great job of setting up the default content for each one, but it’s important to test them all before putting a project live. Testing WooCommerce emails can feel like a big job but luckily there’s a useful admin screen where you can manage and configure each one –

backend wordpress view of woocommerce emails

Above is a screenshot of each of the emails that are created by WooCommerce. When a customer buys a product from a WooCommerce store, they will first receive an order processing notification. Out-of-the-box this email looks like this –

This email is sent automatically to the customer after they complete the checkout process. Let’s pretend this is an Atomic Smash store. The first thing we notice is the brand colours are all wrong! You can change that quite easily in the backend by setting them in the woocommerce > settings > emails (tab) . Let’s set the email settings in accordance the Atomic Smash brand colours –

Using the preview link in this backend admin screen we can quickly check the new styling to make sure it’s looking right –

It’s looking good! Next up, let’s look at trapping these emails with Mailtrap to make sure they are coming through correctly and the content looks correct.

Setting up Mailtrap

To get started with Mailtrap, you can sign up for a free account here. A free account entitles you to one inbox, the premium packages allow you to have multiple inboxes, which is useful if you have a few sites in development or multiple developers testing different processes.

When you first sign-in to Mailtrap you will be able to setup your free testing inbox. After you set this up you will be able to get the snippet you need to set this inbox up to work with WordPress. Navigate to the inbox settings and choosing WordPress from the integrations dropdown. You can copy this snippet straight into the functions.php file within your theme.

With this setup, we can now test to make sure it’s working correctly. If we purchase another product we will see this is now delivered to our Mailtrap inbox.

Wrapping up…

It’s that simple to integrate Mailtrap with your site! This now gives us a great platform to test all of our WooCommerce automated emails and tweak them until they are right.

I hope you found this post useful, let me know how you get on setting it up or if you have any great alternatives!

Related Content

Profile picture of Adam Ward

Adam WardDeveloper

Adam is an expert in WordPress development and CRM integrations. His ability to craft WordPress to a users needs makes our websites easier to use.

Go back to top

Keep up to date with Atomic news