Using the Correct Comparator for Email Sender Conditions in Rules
This article explains how to correctly configure the email sender condition in LiveAgent automation rules, and when to use the contains comparator instead of equals. Choosing the wrong comparator is a common reason why rules based on the sender's email address do not trigger as expected.
Understanding Email Sender Comparators
When you create an automation rule with a From (email sender) condition, you can choose from several comparators. The two most commonly used are:
- equals – Matches only an exact, complete string. The rule triggers only if the sender field in the email matches the value you entered character-for-character.
- contains – Matches any sender field that includes the specified text as a substring. This is useful for matching partial addresses, entire domains, or any pattern within the sender string.
When to Use "equals"
Use equals only when you need to match a single, fully known email address and you are certain the address will always appear in plain format (e.g., support@example.com).
The equals comparator compares the entire sender string as stored in the email header — not just the email address part. If the sender's email client includes a display name label, the string in the email header will look like the example below. In this case, a condition set to From equals support@example.com will not match, even though the email address itself is identical. This is a known behavior and a frequent cause of rules not triggering.
Support Team <support@example.com>
When to Use "contains"
Use contains in most practical scenarios where you are filtering by email address or domain. It is more robust because it matches the address regardless of whether a display name is present.
Examples:
- *From contains @example.com* – Matches all emails from any sender with the example.com domain, whether or not a display name is included.
- *From contains noreply@example.com* – Matches any sender string that includes that address, even if formatted as No Reply <noreply@example.com>.
Common Use Case: Forwarding Emails from a Specific Sender or Domain
If you want to automatically forward all emails from a particular sender or domain to a specific team member, follow these steps:
- Go to Configuration > Automation > Rules.
- Click Create to add a new rule.
- Select the appropriate trigger, for example: Ticket is created.
- Under Conditions, add a condition:
- Field: From
- Comparator: contains
- Value: the email address or domain fragment you want to match (e.g., @example.com)
- Under Actions, select Send email to and enter the recipient's address.
- Click Save and ensure the rule is set to Active.
Troubleshooting: Rule Not Triggering on Email Sender Condition
If your rule is not working as expected when filtering by the sender's email address, check the following:
- Are you using "equals" instead of "contains"? Switch the comparator to contains to handle cases where the sender field includes a display name.
- Is the value spelled correctly? Verify there are no typos or extra spaces in the condition value.
- Is the rule active? Confirm the rule status is set to Active.
- Are the conditions and triggers correct? Make sure the rule trigger matches the type of ticket event you are targeting (e.g., ticket created from email).