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.
This tutorial will show you how to set up Smart Routing in WP Mail SMTP.
In This Article
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.
To use this feature, you’ll need to toggle on the Enable Smart Routing option.
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.
Below the connection, you’ll find the 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.
Below we’ve outlined the available options:
- From Email
- From Name
- Header Name
- Header Value
Next, in the comparison operator dropdown, choose how you’d like to condition the option you selected.
Below we’ve outlined the available options:
- Does not contain
- 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.
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.”
After adding the condition, click on Save Settings to update your changes.
Adding Multiple Conditions
With the AND / OR rules, you can add multiple conditions when configuring Smart Routing.
To use this option, click on the And button.
A new condition will be added below the initial rule.
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.
To use this option, click on Add New Group below the or section. A new condition will be added to the Smart Routing block.
Next, enter the details of the condition you want to check.
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.
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.
It will add a new Smart Routing block below the default 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.
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.
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.