An email security gateway sits in the path of every message your organisation receives, so a careless rollout can lose mail, leave a bypass route straight to the mailbox platform, or hand a third party standing access to every mailbox. This playbook covers rolling out a secure email gateway (SEG) as a product class: architecture and routing choices, MX cutover with a way back, locking down the mail platform behind the gateway, hardening the gateway and its integrations, rolling out filtering policy in rings, and running quarantine and monitoring once it is live. It is vendor-neutral and based on NIST SP 800-177 Rev. 1, IETF RFCs for MTA-STS, TLS reporting and ARC, NCSC email security guidance, NIST SP 800-53 Rev. 5 and mail platform documentation. It is written for messaging engineers, email security owners and SOC leads. The concepts (SEG versus API-based protection, SPF, DKIM and DMARC, filtering) are covered in the Email Security Guide; this page is the deployment runbook.
Key takeaways
The cutover is a DNS change with a long tail. Lower MX TTLs in advance, accept mail on both paths during propagation, and keep the old route ready until a full business cycle has passed.
No lockdown, no protection. If the mailbox platform still accepts mail from the internet directly, attackers deliver around the gateway; restrict inbound connectors to the gateway before you call the rollout done.
Gateway integrations are privileged NHIs. Post-delivery removal and journaling usually need application permissions across all mailboxes; scope, own and monitor them like admin accounts.
Policy goes out in rings. Start in monitor or tag-only mode, then pilot strict policies on IT and security staff before the whole organisation, keeping the old policy available as a group membership rollback.
Quarantine is a security control. Who can release what, and how fast false positives are handled, decides whether users trust the gateway or route around it.
Phase 0: requirements and inventory
Mail flows: list every domain and subdomain that receives mail, every MX record, every system that sends as your domains (marketing, CRM, ticketing, scanners, printers, applications using SMTP relay) and every existing connector and transport rule. Unknown senders discovered after cutover are the most common cause of outbound breakage.
Protection goals: decide which threats the gateway must handle: commodity spam and malware, credential phishing (ATT&CK T1566.002 Spearphishing Link), malicious attachments (T1566.001 Spearphishing Attachment), impersonation and business email compromise, and outbound data loss. Internal phishing from compromised mailboxes (T1534 Internal Spearphishing) usually never passes a perimeter gateway; plan how it is covered.
Compliance needs: retention, journaling, data residency of quarantined mail and logs, and encryption requirements. Quarantined mail is personal data and sometimes legally privileged.
Success criteria: agree target metrics (malicious mail reaching inboxes, false positive rate, quarantine release time, mail delay) with the business before the pilot.
Phase 1: architecture and routing design
Pattern
How mail flows
Strengths
Watch for
MX to gateway (inline, pre-delivery)
Internet to gateway to mailbox platform
Blocks before delivery; single inbound choke point
Direct-to-platform bypass; original sender IP hidden from the platform; DKIM broken by rewriting
MX to mailbox platform, gateway after it
Internet to platform to gateway and back
No MX change; platform filtering runs first
More complex routing loops; documented by platforms as a special integration mode
API-based protection alongside native filtering
No routing change; gateway reads and remediates through the platform API
Sees internal mail; fast rollout; no single point of mail failure
Broad application permissions to all mailboxes; detection after delivery
Outbound smart host
Platform relays outbound mail through the gateway
Outbound DLP, encryption, disclaimers
SPF and DKIM must authorise and sign at the last hop
High availability: confirm the gateway has multiple MX hosts across sites or regions and how it queues mail if the mailbox platform is unreachable. Ask how long it spools and where.
Transport security: the gateway must send and receive with TLS (NCSC guidance and NIST SP 800-177 Rev. 1). If you publish an MTA-STS policy (RFC 8461), its mx lines must list the new gateway hosts and the gateway's certificates must be valid for those names before cutover, or enforcing senders will refuse delivery.
Message modification: link rewriting, banners and attachment replacement break DKIM signatures downstream. If the gateway supports ARC (RFC 8617, Experimental), add it as a trusted ARC sealer on the mailbox platform so later authentication checks still work.
Phase 2: hardening the gateway and its integrations
Admin access: SSO with phishing-resistant MFA, no shared admin accounts, a vaulted break-glass account, and separated roles: platform admin, policy admin, SOC analyst (search and purge), and quarantine reviewer (AC-6(5)).
Quarantine permissions: decide which categories end users may release themselves (typically bulk and spam) and which need an analyst (malware, high-confidence phishing, impersonation). Restrict who can create sender allow lists; a broad allow entry is a permanent bypass.
API and mailbox permissions: post-delivery removal, user-reported message handling and journaling usually run as an application with read and delete rights across mailboxes. Scope it to the mailboxes needed where the platform supports it, use certificate or federated credentials rather than long-lived secrets, give it an owner and alert on its use from unexpected locations. Abuse of an over-permissioned application to read executive mailboxes is the core of the Microsoft Midnight Blizzard Breach 2024; see the Consent Phishing and Illicit OAuth Grants Guide.
Directory sync: the gateway usually syncs users and groups for recipient validation and policy targeting. Use a read-only sync identity and enable recipient validation so mail to non-existent users is rejected rather than accepted and bounced.
Logs: forward admin actions, policy changes, allow list changes, quarantine releases and message trace data to the SIEM (AU-6).
Patching and exposure: for self-hosted or virtual appliances, the gateway is an internet-facing system that processes hostile content all day; patch it on the emergency track and restrict its management interface to admin networks. Ongoing controls are in Securing the email security gateway itself.
Phase 3: MX cutover with a way back
Lower TTLs: reduce the MX record TTL well before cutover (at least the old TTL in advance) so the change and any rollback propagate quickly. This is general DNS practice; confirm with your DNS provider.
Configure both paths: set up the gateway's outbound delivery to the mailbox platform and an inbound connector on the platform that accepts mail from the gateway, before changing MX.
Pilot domain: cut over a low-risk secondary domain first, verify delivery, headers, authentication results and latency, then schedule the primary domains.
Change the MX: point MX at the gateway in a low-traffic window, monitor queues on both systems, and keep accepting mail directly at the platform while senders' caches expire.
Restore sender visibility: where the mailbox platform supports it, enable its enhanced filtering or skip-listing feature for the gateway connector so the original sender IP is evaluated for SPF and DMARC, rather than the gateway's address.
Lock down: after propagation, restrict the platform's inbound connector to accept internet mail only from the gateway, by certificate (preferred) or IP. Microsoft's guidance, for example, uses a Partner inbound connector with TlsSenderCertificateName and RestrictDomainsToCertificate. Test by sending directly to the platform endpoint from outside: it must be rejected.
Remove bypasses: delete transport rules that skip filtering for the gateway's IP addresses. Mail platform documentation warns that gateway providers often share IP ranges across customers, so such rules can let spoofed mail through.
Rollback: keep the previous MX values documented and the platform still able to accept direct mail (unlock the connector) until the gateway has run through a full business cycle. Rollback is an MX change plus connector unlock; rehearse it once.
Phase 4: policy rollout in rings
Ring
Users
Policy state
Exit criterion (NHI Mgmt Group recommendation)
0. Monitor
All
Detect and tag or log only; existing protection remains authoritative
Detection comparison with existing tooling reviewed for two weeks
1. Pilot
IT and security staff
Quarantine, attachment sandboxing, link rewriting, impersonation protection
False positives handled within agreed time; no lost mail
2. High risk
Executives, finance, HR, payroll, help desk
Strict impersonation and payment-fraud rules
Release requests reviewed; VIP lists accurate
3. Broad
10 to 20 per cent, then everyone
Standard policy
Help desk ticket volume back to baseline
4. Outbound
All senders
DLP in audit mode, then enforcement; external auto-forwarding blocked with exceptions
DLP false positive rate acceptable to data owners
Policy as group membership: apply new policies through groups so rollback for a ring is a membership change, not a policy rewrite.
Attachment and URL handling: decide whether to hold messages until sandbox and URL analysis finish (safer, slower) or deliver with dynamic replacement (faster, with a window of exposure), per ring.
User reporting: connect the report button to the gateway or SOC queue so reported messages trigger a search and purge of the same campaign.
Sender authentication: once routing is stable, continue the DMARC journey to enforcement; see the DMARC, SPF and DKIM Guide and the Email Authentication Checklist. If you publish MTA-STS, run it in testing mode with TLS reporting (RFC 8460) before enforce.
Running the gateway after go-live
Allow list review: review sender and domain allow entries monthly; every entry needs an owner, a reason and an expiry.
Campaign response: document and rehearse search and purge across all mailboxes, including who approves a purge and how evidence (headers, URLs, attachments) is preserved for the SOC.
Change control: treat policy, routing and connector changes as changes with peer review; a single connector edit can reopen the bypass route.
New senders: route requests for new SaaS senders through a standard process that sets up SPF, DKIM and the outbound path, so business teams do not ask for blanket exceptions.
Feeds and engines: confirm signature and threat intelligence updates arrive automatically (SI-8(2)) and alert if they stop.
Decision guidance
Inline gateway or API-based protection: inline gateways block before delivery and give one outbound control point; API-based tools see internal mail and are quicker to deploy, but act after delivery and need broad mailbox permissions. Many organisations combine native platform filtering with one of the two, rather than stacking three layers that fight over message verdicts.
Hold or deliver while scanning: hold for high-risk groups and for attachments; dynamic delivery where business speed matters more and post-delivery removal is reliable.
Small organisations: native filtering in the mail platform plus strong DMARC, MFA and user reporting is often enough; add a gateway only when native controls demonstrably miss threats.
Large organisations: multiple domains, mergers and on-premises relays make the inventory and lockdown phases the long pole; staff the cutover as a project with messaging, DNS, SOC and help desk.
Detection and measurement
Alert on: admin and allow-list changes, bulk quarantine releases, new transport rules that skip filtering, connector changes on the mailbox platform, mailbox forwarding rules created after a phishing click (ATT&CK T1114.003 Email Forwarding Rule), and use of the gateway's mailbox application from unexpected addresses (T1114.002 Remote Email Collection).
Metric
Why it matters
Malicious messages removed post-delivery per week
Measures what the pre-delivery layer missed
False positive rate and median quarantine release time
Trust and usability of the gateway
Messages arriving at the mailbox platform not via the gateway
Should be zero after lockdown
Allow list entries without owner or expiry
Bypasses that accumulate silently
User-reported phishing rate and time to campaign purge
Speed of response to what gets through
Mail delivery latency at the 95th percentile
Detects sandbox holds that push users to complain or bypass
Bypass left open: the mailbox platform still accepts internet mail directly, so attackers who look up the platform endpoint skip the gateway entirely.
IP-based skip rules: transport rules that trust the gateway's shared IP ranges and let spoofed mail through.
Unknown senders broken at cutover: applications and SaaS senders that relayed through the old path stop working, and SPF records are widened in a hurry.
MTA-STS forgotten: an enforcing MTA-STS policy still lists the old MX hosts, and enforcing senders refuse to deliver.
Over-permissioned mailbox application: a gateway integration with full access to every mailbox, a long-lived secret and no owner.
Permissive allow lists: whole domains allow-listed to fix one false positive, then used by attackers who compromise or spoof that domain.
Practitioner checklist
Inventory domains, MX records, connectors, transport rules and every system that sends as your domains.
Choose the routing pattern and confirm high availability, spooling and TLS on all gateway hosts.
Update MTA-STS mx lines and certificates before the MX change.
Harden admin roles, quarantine release rights and allow-list permissions.
Scope, own and monitor the gateway's mailbox application and directory sync identities.
Lower TTLs, cut over a pilot domain, then primary domains, with a rehearsed MX rollback.
Lock the mailbox platform to accept internet mail only from the gateway and remove IP bypass rules.
Roll out policy from monitor to pilot, high-risk and broad rings, and report bypass, false positive and purge metrics monthly.
Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.
NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 11 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security.
nhimg.org
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.