This page shows how to route Google Workspace (Gmail) mail through mxHERO in the Google Admin console, and which Server and Relay Server values to set in mxHERO. It covers all four architectures. Choose your architecture first: see Routing architectures.
Before you begin
- You need a Google Workspace super administrator account. Sign in at admin.google.com.
- Copy the Transport Agent value from Settings › Gateway in the Admin Dashboard. In this page it is shown as
<TA>. It is 32 lowercase hexadecimal characters, for example585439da368cbc9d4fe026ab3795e8c7(yours is different). - Your domains must be added in mxHERO. See Organization and domains.
- To start with a pilot group, create the Google group first. See Selective routing.
Values used on this page:
| Item | Value |
|---|---|
| Inbound host (mail into mxHERO for inbound processing) |
smtp-in.mxhero.com, port 25
|
| Outbound host (mail into mxHERO for outbound processing) |
smtp-relay.mxhero.com, port 25
|
| mxHERO IP addresses |
54.208.111.28, 54.236.184.32, 54.165.252.128, 54.165.253.193, 3.211.77.148, 52.22.51.97, 54.209.222.83, 107.23.152.206
|
| mxHERO Server | smtp.google.com |
| mxHERO Relay Server (Outbound Loopback) | smtp-relay.gmail.com |
Warning: Do not use
smtp.mxhero.comfor any Gmail host. Older guides used it. Usesmtp-in.mxhero.comfor inbound andsmtp-relay.mxhero.comfor outbound. Mixing up the two hosts is a common cause of loops.
Gmail settings changes can take up to an hour to apply to all users.
Which steps you need
| Step | Inbound Loopback | Inbound Border | Outbound Standard | Outbound Loopback |
|---|---|---|---|---|
| 1. Inbound gateway | Yes | Yes | – | – |
2. Host mxHERO Inbound
|
Yes | – | – | – |
| 3. Inbound content compliance rule | Yes | – | – | – |
4. Host mxHERO Outbound
|
– | – | Yes | Yes |
| 5. Outbound content compliance rule | – | – | Yes | Yes |
| 6. SMTP relay service rule | – | – | – | Yes |
| 7. Server in mxHERO | Yes | Yes | Yes | Yes |
| 8. Relay Server in mxHERO | – | – | Empty | smtp-relay.gmail.com |
| 9. SPF | Yes | Yes | Yes | Yes |
No ARC setup is needed in Google Workspace. mxHERO ARC-seals every message it processes, and Gmail evaluates ARC seals automatically. There is no trusted-sealer list to edit.
Step 1: Configure the inbound gateway
This tells Gmail that mail from the mxHERO IP addresses comes from a gateway, so Gmail checks the original sender instead of mxHERO.
In the Admin console, go to Apps › Google Workspace › Gmail › Spam, phishing, and malware.
Select the top-level organizational unit.
Open Inbound gateway and click Configure (or Edit).
Under Gateway IPs, add the 8 mxHERO IP addresses.
Select Automatically detect external IP (recommended).
Leave Reject all mail not from gateway IPs clear.
Leave Require TLS for connections from the email gateways listed above clear.
-
Inbound Loopback only: set up message tagging so Gmail reuses the spam verdict from its first pass:
- Select Message is considered spam if the following header regexp matches.
-
Regexp:
^X-Gm-spam: (0|1)$ - Select Regexp extracts a numeric score. Set Message is considered spam if extracted numeric score is to Greater than or equal to
1. - Select Disable Gmail spam evaluation on mail from this gateway; only use header value.
For Inbound Border, leave message tagging at its defaults.
Click Save.
Step 2: Add the inbound host (Inbound Loopback)
- Go to Apps › Google Workspace › Gmail › Hosts and click Add route.
-
Name:
mxHERO Inbound. -
Specify email server: Single host. Hostname
smtp-in.mxhero.com, port25. - Under Options, leave Perform MX lookup on host clear. Select Require secure transport (TLS) and Require CA signed certificate.
- Click Save.
Step 3: Add the inbound content compliance rule (Inbound Loopback)
This rule sends inbound mail to mxHERO, adds the Transport Agent header, and skips mail that mxHERO has already processed.
- Go to Apps › Google Workspace › Gmail › Compliance.
- Select the top-level organizational unit.
- Next to Content compliance, click Configure (or Add another rule).
-
Content compliance:
mxHERO inbound routing. - 1. Email messages to affect: select Inbound and Internal - receiving. Leave Outbound and Internal - sending clear.
-
2. Add expressions that describe the content you want to search for in each message: select If ANY of the following match the message, then click Add and set:
- Expression type: Advanced content match
- Location: Full headers
- Match type: Not contains text
-
Content:
X-mxHero-Server: <TA>
-
3. If the above expressions match, do the following: Modify message, then:
- Under Headers, select Add X-Gm-Spam and X-Gm-Phishy headers. The inbound gateway (Step 1) reads these headers on the second pass.
- Select Add custom headers and add header key
X-mxHero-Transport-Agent, value<TA>. - Under Route, select Change route and choose
mxHERO Inbound.
- For a pilot group, click Show options and set Envelope filter › Only affect specific envelope recipients › Group membership (only received mail) to your group.
- Click Save, then Save again at the bottom of the page if shown.
Warning: The expression must test
X-mxHero-Serverwith Not contains text. If it testsX-mxHero-Transport-Agent, or uses Contains text, mail loops.
Step 4: Add the outbound host
- Go to Apps › Google Workspace › Gmail › Hosts and click Add route.
-
Name:
mxHERO Outbound. -
Specify email server: Single host. Hostname
smtp-relay.mxhero.com, port25. - Leave Perform MX lookup on host clear. Select Require secure transport (TLS) and Require CA signed certificate.
- Click Save.
Step 5: Add the outbound content compliance rule
- Go to Apps › Google Workspace › Gmail › Compliance › Content compliance › Add another rule.
-
Content compliance:
mxHERO outbound routing. - 1. Email messages to affect: select Outbound and Internal - sending. Leave Inbound and Internal - receiving clear.
-
2. Add expressions: If ANY of the following match the message, then add:
- Expression type: Advanced content match
- Location: Full headers
- Match type: Not contains text
-
Content:
X-mxHero-Server: <TA>
-
3. If the above expressions match, do the following: Modify message, then:
- Select Add custom headers and add
X-mxHero-Transport-Agent=<TA>. - Under Route, select Change route and choose
mxHERO Outbound.
- Select Add custom headers and add
- For a pilot group, click Show options and set Envelope filter › Only affect specific envelope senders › Group membership (only sent mail) to your group.
- Click Save.
Important: Use this rule, not the Gmail Outbound gateway setting. The outbound gateway sends all mail to mxHERO with no Transport Agent header and no loop exception. Without the header, mxHERO does not run your rules when Only process email rules with transport agent header (Strict Mode) is on, and with Outbound Loopback the mail loops. If an older setup has
smtp.mxhero.comor another mxHERO host in Outbound gateway, remove it after the rule is working.
Step 6: Allow mxHERO to relay through Gmail (Outbound Loopback)
- Go to Apps › Google Workspace › Gmail › Routing.
- Next to SMTP relay service, click Configure (or Add another rule).
- Enter a description, for example
mxHERO return relay. - Allowed senders: Only registered Apps users in my domains.
- Authentication: select Only accept mail from the specified IP addresses, and add the 8 mxHERO IP addresses.
- Encryption: select Require TLS encryption.
- Click Save.
Steps 7–8: Set Server and Relay Server in mxHERO
- In the Admin Dashboard, open Settings › Organization and domains › Domains.
- Edit each domain:
-
Server:
smtp.google.com. Required for every architecture, even outbound only. -
Relay Server:
smtp-relay.gmail.comfor Outbound Loopback. Leave it empty for Outbound Standard. To send through a border gateway, enter its hostname (see Border gateways). - Leave MX Lookup off.
-
Server:
- Save.
If the Server is missing or wrong, inbound mail can loop and bounce. See Domain Server and Relay settings.
Warning: Never use an MX lookup for a host that resolves to Gmail, in Gmail Hosts or in mxHERO. Mail goes straight back into the routing rules and loops. Always use the explicit hosts on this page.
Step 9: Update SPF
Add include:_spf.mxhero.com to your existing SPF record. Do not create a second SPF record. Note the leading underscore.
v=spf1 include:_spf.google.com include:_spf.mxhero.com ~all
For Outbound Standard, also set up DKIM signing for mxHERO. See SPF, DKIM and DMARC.
Verify
- Create a test rule in mxHERO for a test user. See Testing mail flow.
- Send a message from an outside account to the test user. In Gmail, open the message › More › Show original. Check that
X-mxHero-Serveris present and that ARC and SPF pass. - Send a message from the test user to an outside account and check its headers the same way.
- Find both messages in Reports › Email Flow Logs.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
Mail loops ("too many hops", or 554 Message exceeded 50 hops) |
Compliance rule tests the wrong header or match type; <TA> doesn't match Settings › Gateway; a host uses MX lookup; Server missing |
Use X-mxHero-Server: <TA> with Not contains text. Copy the value again. Clear MX lookup. Set Server to smtp.google.com. |
| Processed mail lands in spam | Inbound gateway IPs incomplete, or message tagging not set for loopback | Check all 8 IPs. For loopback, select Disable Gmail spam evaluation on mail from this gateway; only use header value. |
| Outbound mail reaches mxHERO but no rule runs | Mail sent through Outbound gateway without the Transport Agent header | Use the content compliance rule (Step 5) and remove the outbound gateway. |
| A pilot user is not processed | User not in the group, or group change not yet applied | Check membership. Allow a few minutes after changes. |
| DKIM fails at some recipients | mxHERO changed the message | Expected. ARC preserves the original result. Set up DKIM for mxHERO; see SPF, DKIM and DMARC. |
| SPF fails | Include missing or misspelled (include:mxhero.com) |
Use include:_spf.mxhero.com. |
Comments
0 comments
Please sign in to leave a comment.