DEV Community

Cover image for How to Test Your WooCommerce Emails: Insights and Obstacles to Overcome
Ivan Djuric
Ivan Djuric

Posted on • Originally published at mailtrap.io

How to Test Your WooCommerce Emails: Insights and Obstacles to Overcome

After weeks of research and some trial and error, I can firmly say – it is impossible to thoroughly test emails and email sending using any WooCommerce built-in features or plugins.

To be clear – both options offer some email testing features, but they’re pretty limited.

Nevertheless, these features can still be helpful for some minimal email testing.

So, in this guide, I’ll still cover them and show you how to use Mailtrap Email Testing to test your emails and email sending correctly.

Defining email testing and email sending testing

Before we go any deeper into the topic, I want to clarify what email testing involves:

  • Testing of emails is verifying that the content, layout, and functionality of emails render correctly across various email clients and devices. This ensures that messages are received and visually appear as intended.
  • Testing of email sending focuses on ensuring the reliability and performance of your email delivery. This process checks that emails are not just sent but also reach the recipients’ inboxes and avoid spam filters.
  • Email testing in the context of WooCommerce is crucial for ensuring that transactional emails, like order confirmations and shipping updates, are delivered and displayed correctly. This helps boost customer trust, delivers key order details, and improves the shopping experience.

To better understand these nuances, check out the video below:

Test emails using WooCommerce Email Preview

The WooCommerce built-in email preview allows you to only inspect how an email appears. You won’t be able to test email deliverability, get a spam analysis, check device compatibility, etc.

This approach is practical when you are confident in your email-sending service, and you only need to check that the email template’s design correctly displays all its elements.

Here is how you can quickly activate the built-in “Email Preview” feature:

  1. Access WooCommerce Settings

Navigate to your WordPress admin dashboard, click ‘WooCommerce’, and select ‘Settings’.

Image description

  1. Go to the Emails Tab

Find and click on the ‘Emails’ tab, where all the types of emails WooCommerce sends are listed. Click the ‘Manage’ button for the email you wish to preview.

Image description

  1. Preview the Email Template

In the selected WooCommerce email settings, you’ll find an option to preview your email template. This lets you see how the subject line, email body, and the rest of the layout will appear, helping ensure everything is formatted correctly before sending it out to customers.

Image description

As mentioned earlier, this is just a simple email preview, and if you are a high-volume sender, it is always best to test email deliverability issues so they don’t impact your business.

Test emails using a mailing plugin and Mailtrap

With over three million downloads, WP Mail SMTP is the most popular email plugin in the WordPress ecosystem. There is a good chance you already have it installed in your store – if not, here’s the installation guide.

This plugin reconfigures WordPress to use a proper SMTP provider with host credentials instead of the default wp_mail() PHP mail function. To test emails, I simply indicate the fake SMTP server credentials of Mailtrap Email Testing in the plugin.

This way, I can trap the email in a sandbox where I can inspect and debug it before it reaches recipients.

SMTP

To install the plugin and start using it with Email Testing, follow these steps:

  1. Create a new account with Mailtrap and navigate to your first inbox by clicking ‘Email Testing’, ‘Inboxes’, then “My Inbox”.

Image description

  1. Once inside “My Inbox”, click “Show credentials”

Image description

a. Here, you will find your Email Testing SMTP/POP3 credentials that you’ll need to configure later in WP Mail SMTP plugin’s settings.

Image description

  1. Next, from your WordPress admin dashboard, navigate to the ‘Plugins’ section and press ‘Add New’.
  2. Search for ‘WP Mail SMTP’, install it, and press ‘Activate’.

Image description

  1. When the plugin is activated, navigate to its settings. Find the fields for ‘From Email’ and ‘From Name’ in the ‘General’ settings and fill them out.

Image description

  1. After that, scroll to the section labeled ‘Mailer’ and select ‘Other SMTP’.

Image description

  1. Scroll down to add credentials for ‘Other SMTP’, and start copy-pasting Mailtrap Email Testing SMTP credentials into the designated fields:
  • SMTP Host: sandbox.smtp.mailtrap.io
  • Encryption: SSL or TLS
  • SMTP Port: 25 or 465 or 587 or 2525 (will be filled out automatically once you choose encryption)
  • Authentication: toggle On
  • SMTP Username: your Mailtrap username
  • SMTP Password: your Mailtrap password

Image description

  1. Click the ‘Save Settings’ button; you’ll see the confirmation notifications at the top of the WP Mail SMTP General tab.
  2. Once the SMTP connection is established, navigate to the ‘Email Test’ tab, enter your email address, toggle the HTML switch on or off, and press ‘Send’.

Image description

  1. Within minutes, you can find the email in your Mailtrap inbox to analyze HTML errors, check spam scores, review blacklist status, and more.

Image description

Test Emails with Mailtrap for Free

API

To integrate Mailtrap Email Testing via API with the WP Mail SMTP plugin, you’ll need to use PHPMailer in your WordPress environment.

WordPress already includes PHPMailer, so you don’t need to install it separately.

  1. In the ‘My Inbox’ page, scroll down to the ‘Integrations’ drop-down menu, select PHPMailer, and copy the code that will appear.

Image description

  1. Next, customize how the WP Mail SMTP plugin sends emails by adding the code to your theme’s functions.php file.
add_action( 'phpmailer_init', 'custom_phpmailer_init' );
function custom_phpmailer_init( PHPMailer $phpmailer ) {
    $phpmailer->isSMTP();     // Set mailer to use SMTP
    $phpmailer->Host = 'sandbox.smtp.mailtrap.io';  // Specify Mailtrap server
    $phpmailer->SMTPAuth = true;                    // Enable SMTP authentication
    $phpmailer->Port = 2525;                        // SMTP port
    $phpmailer->Username = 'your Mailtrap username';    // Your Mailtrap username
    $phpmailer->Password = 'your Mailtrap password';    // Your Mailtrap password
    $phpmailer->SMTPSecure = 'tls';                 // Encryption to use - 'ssl' or 'tls'
}
Enter fullscreen mode Exit fullscreen mode
  1. After you’ve made these changes, just like with SMPT, use the ‘Email Test’ tab in the WP Mail SMTP settings to send a test email.

Wrapping Up

Whether previewing basic WooCommerce email templates directly in the eCommerce platform or leveraging add-ons and advanced email testing tools, the goals remain the same: ensuring your emails look great, achieve optimal deliverability, and perform well across all of the different platforms and devices.

Check out the tutorials below for more help and a deeper understanding of email management. They’re designed to boost your knowledge and skills, making them a great starting point for anyone eager to master WooCommerce test email techniques.

We appreciate you chose this article to know how to send WooCommerce emails with Mailtrap. Read more interesting articles on related topics on Mailtrap blog!

Top comments (0)