Site icon Mailtrap

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

This is a cover image for an article that goes over in detail how to test emails in WooCommerce

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: 

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’.

  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.

  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.

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”. 
  1. Once inside “My Inbox”, click “Show credentials” 

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. 

  1. Next, from your WordPress admin dashboard, navigate to the ‘Plugins’ section and press ‘Add New’. 
  1. Search for ‘WP Mail SMTP’, install it, and press ‘Activate’.
  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.
  1. After that, scroll to the section labeled ‘Mailer’ and select ‘Other SMTP’. 
  1. Scroll down to add credentials for ‘Other SMTP’, and start copy-pasting Mailtrap Email Testing SMTP credentials into the designated fields:
  1. Click the ‘Save Settings’ button; you’ll see the confirmation notifications at the top of the WP Mail SMTP General tab. 
  1. 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’.
  1. Within minutes, you can find the email in your Mailtrap inbox to analyze HTML errors, check spam scores, review blacklist status, and more.

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.
  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'
}
  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. 

Exit mobile version