For the complete documentation index, see llms.txt. This page is also available as Markdown.

Email contains

Match logged-in customers whose email address contains a given string, such as a company domain.

The Email contains rule checks whether the logged-in customer's email address contains a specific piece of text. It's most useful for matching an entire company by their email domain, without needing to tag every individual account.

How it works

The rule only looks at the email of a customer who is currently signed in — a guest without a session has no email for the rule to check. You give it one or more strings to look for; the rule matches if the customer's email contains any of them.

To match more than one string, separate them with the word or in the same field — for example, entering @wholesaleco.com or @partnerco.com matches any customer whose email contains either domain.

Adding the rule

  1. Open the lock you want to protect and click the Unlock rules tab.

  2. Add an access rule and choose Email contains from the Condition type dropdown.

    Access rule picker with Email contains selected and a text field for the match string
    Adding the Email contains rule and entering the text to match.
  3. Enter the text to match — for example a company email domain like @wholesaleco.com. Add more strings separated by "or" if you need to match several domains or addresses.

  4. Choose whether the rule should match If (the email contains the string) or Unless (it doesn't).

  5. Optionally set a per-rule Redirect URL.

  6. Save the lock.

Since this rule depends on the visitor being logged in, it's often paired with the Logged-in customers rule in the same access key — that way a guest gets a clear "please sign in" message instead of simply failing this rule with no explanation.

Example: Allow employees with an approved company email

Suppose an internal resources page should only be available to signed-in customers whose email address contains @acme.com.

  1. Select the Company resources page as the content to protect.

The Lock setup tab with Specific Page as the content type and the Company resources page listed under Restricted pages.
Pick the internal page you want to gate.
  1. On the Unlock rules tab, the first condition already defaults to Logged-in customers — leave it. Click Add key condition to add a second condition in the same access key and set it to Email contains.

  2. For Email contains, choose If and enter @acme.com in the Email address field.

The second condition set to Email contains with Rule logic If and @acme.com in the Email address field.
The condition heading confirms it: If the customer email matches @acme.com.
  1. Leave the rules' Redirect URL fields empty.

  2. Set the messages to:

    • Guest message content: Sign in with your approved company email to continue.

    • Access denied message: Your email address is not approved for this resource.

Both fields appear because Email contains is one of the five customer-identity rules — see Access rules overview. The guest message goes to signed-out visitors; the access-denied message goes to signed-in customers whose email doesn't match.

The Messages card showing both the Guest message content and Access denied message fields filled in with the example wording.
This rule needs both messages, because either kind of visitor can be blocked.
  1. Click Save.

Result on the storefront

  • A signed-out visitor sees the Guest message and the sign-in option.

  • A signed-in customer such as alex@acme.com passes both conditions and can open the page.

  • A signed-in customer such as alex@example.com sees the Access denied message because their email does not contain @acme.com.

The Company resources page displaying the configured email-not-approved message.
A signed-in customer using an email outside the approved domain sees the Access denied message from this example.

Last updated

Was this helpful?