Setting Up Smart Email Routing

Would you like to set up your WordPress site to conditionally send emails using different connections? WP Mail SMTP’s Smart Routing feature allows you to configure which mailer connection to use depending on the conditions you set.

In this tutorial, we’ll show you how to set up Smart Routing in WP Mail SMTP.


Before getting started, you’ll first need to ensure WP Mail SMTP is installed and activated on your WordPress site and that you’ve verified your license.

Enabling Smart Routing

Note: Before setting up Smart Routing, you’ll need to have at least one additional connection configured in WP Mail SMTP.

After you’ve added an additional connection, go to WP Mail SMTP » Settings. Then click on the Smart Routing tab.

smart routing tab

To use this feature, you’ll need to toggle on the Enable Smart Routing option.

enable smart routing

After you’ve enabled this option, proceed to configure your settings.

Configuring Smart Routing Settings

In the Select a Connection dropdown, choose an additional connection that’ll be used if the conditions you set are met.

select a connection

Below the connection, you’ll find the conditions section.

conditions section

Here is a brief overview of the available options:

  • Condition type: This field contains the options you’d like to base the condition on.
  • Operator: This field contains various comparison operators for configuring the condition.
  • Value: In this field, you’ll need to enter the text or keyword to compare with the condition type.

In the condition type dropdown, you’ll find options for setting up the condition.

condition type field

Below we’ve outlined the available options:

  • Subject
  • Message
  • From Email
  • From Name
  • To
  • CC
  • BCC
  • Reply-To
  • Header Name
  • Header Value
  • Initiator

Next, in the comparison operator dropdown, choose how you’d like to condition the option you selected.

comparison operator

Below we’ve outlined the available options:

  • Contains
  • Does not contain
  • Is
  • Is not
  • Starts with
  • Ends with

In the value field, enter the text you’d like to use as the condition for sending emails with this connection.

smart routing value field

Note: If you choose the Initiator condition type, you’ll only have access to the Is and Is not comparison operators. Also, the value field will include a dropdown with a list of services that can send emails from your website.

As an example, we’ll use the SendLayer mailer if the Subject contains the term “Inquiry.”

example smart routing condition

After adding the condition, click on Save Settings to update your changes.

save settings

Adding Multiple Conditions

With the AND / OR rules, you can add multiple conditions when configuring Smart Routing.

AND

To use this option, click on the And button.

adding and condition

A new condition will be added below the initial rule.

new and block

Go ahead and configure the conditions with the options you’d like to check.

With the AND rule set up, the Smart Routing condition will only be true if all of the individual conditions are met.

OR

To use this option, click on Add New Group below the or section. A new condition will be added to the Smart Routing block.

add new group

Next, enter the details of the condition you want to check.

configuring or rule

In our example, we’ve set the condition to use the SendLayer mailer if the Subject contains the term “Inquiry” or the Initiator of the email is WP Core.

After adding an OR rule, the Smart Routing condition will be true if one of the individual conditions are met.

Once you’re satisfied with the conditions, go ahead and click the Save Settings button.

save settings

Now when emails are sent from your WordPress site, WP Mail SMTP will use the connection you selected if the conditions are met.

Note: If none of the conditions are met, your WordPress site will send emails using the Primary Connection.

Adding a New Smart Routing Block

You can set multiple Smart Routing conditions for each additional connection you configure on your website. This can be useful if you’d like to use different connections for every plugin that can send emails on your website.

To create a new condition, click on Add New.

add new smart routing condition

It will add a new Smart Routing block below the default block.

new smart routing block

The process of configuring the additional condition is the same as we’ve seen above. Be sure to save your settings after configuring an additional Smart Routing block .

Deleting a Smart Routing Condition

If you’d like, you can delete one of the Smart Routing conditions you’ve set up. To delete a Smart Routing block, click on the trash icon.

delete smart routing block

If you’ve set up multiple conditions using the AND / OR rules, you can delete any of them by clicking on the trash icon next to each condition.

delete and or condition

That’s it! You now know how to set up Smart Routing to conditionally send emails using different connections.

Next, would you like to have control over which emails WordPress core sends out? Be sure to check our guide on using email controls to learn more.