As a Gmail admin, you can create rules to manage spam, email content, and email attachments for your organization. You might need new rules when you add a Google Workspace service, or when you’re setting up Gmail security.
When creating rules, you usually have to change and test them several times to make sure they work correctly for your organization. Each time you change a rule, it can take up to 24 hours for the change to take effect across your entire organization.
We recommend you try out new rules in a test environment with only a few users. A small test environment lets you test rules more quickly than testing them across your entire organization. After you verify the rules in a test environment, you can apply them to the entire organization.
How organization size and structure affect rules updates
- Tests take longer because the test organizational units includes the rules from its parent. More rules increase the test time.
- It’s difficult to isolate and identify which rules cause issues during tests, because child organizational units inherit rules from the parent.
We recommend you avoid testing rules with groups because:
- Rule update time corresponds to group size (number of members). It can be difficult to determine a Group’s size and predict how long it takes to update rules for a group.
- It’s more complex to test rules and isolate issues for nested groups
Best practices for rules test environment
Recommendation | Details |
---|---|
Create a test environment with a few users | A small test environment lets you quickly update rules, and verify how they affect email flow and delivery. The size of the environment where the rule is used directly affects how long it takes for the rule to update. Learn more about what affects the speed of rule updates. |
Use a recommended test environment |
Use one of these types of test environments:
|
Set up the test domain just like your primary domain | If you use a secondary test domain, set it up like your primary domain so that rules behavior mimics what will happen in your primary domain. |
Remove any extra rules from the test environment | Add only the rules you’re testing to the test environment. If you’ve tested rules in this environment in the past, remove old rules before adding and testing new ones. |
Best practices for creating and testing rules
Recommendation | Details |
---|---|
Test rules with real data | Test the same type of email attachments and content (including secure content) that you normally use in your organization. |
Avoid long strings or long lists | Avoid using expressions with more than 1000 characters, and lists with more than 1000 elements. Long expressions need more time to take effect than shorter expressions. Long expressions are also more likely to have errors that require troubleshooting. |
Check the rule syntax first |
Before applying rules in the test environment, check the rule syntax with real data. This lets you get test results similar to what you'll get in your organization:
|
Add only the rules you’re testing to the test environment |
We recommend your test environment has only the rules you’re testing. Multiple rules and the order in which they’re applied can impact message behavior. If you need to test how a new rule interacts with existing rules: Copy the new rule into a test organizational unit that is a child of the organizational unit that uses the existing rules. Learn how multiple rules affect message behavior. |
Don’t use group-based policies | Group-based policies often take up to 24 hours to take effect, even for smaller groups. When you add a new rule with Add Setting, uncheck Groups under the Account types to affect option. |
Use a unique subject line for each message used to test a rule | Unique subject lines help you identify which rules have been applied to test messages. Email log search lists messages by subject line. Each message entry indicates which rule was applied to the message. |
Every time you update a rule, change the rule name | Email log search shows rules by name. When updating and testing a rule several times, a unique rule name helps you know which version of the rule you’re testing. |
Best practices for verifying rules
Use Email log search to check which rules have been applied to test messages. Email log search lets you find test messages, and shows which rule was applied to each message.