Search documentation

Search all documentation pages

Gmail Integration

Scan Gmail messages and attachments for policy violations.

Overview

The Gmail integration connects Aguardic to your Google Workspace email via OAuth. Aguardic monitors incoming and outgoing emails, evaluating message content and attachments against your policies and enforcing actions through Gmail labels and quarantine.

Setup

1. Connect via OAuth

Go to Integrations > Add Integration > Gmail in the Aguardic dashboard and click Connect. You'll be redirected to Google to authorize Aguardic with the required Gmail API permissions.

The Gmail integration requires Google Workspace (business) accounts. Personal Gmail accounts have limited API access.

2. Bind Policies

After connecting, go to Policy Bindings and map your policies to the Gmail integration. You can create separate policies for inbound and outbound email.

3. Configure Enforcement

Choose how Aguardic enforces policy results on Gmail:

  • BLOCK — Moves the email to the "Aguardic Quarantine" label and applies the "Aguardic Violation" label, removing it from the inbox
  • WARN — Applies the "Aguardic Warning" label to the email, keeping it in the inbox
  • MONITOR_ONLY — No visible action in Gmail, violations logged in Aguardic only

How It Works

  1. An email is sent or received
  2. Google sends a push notification to Aguardic via webhook
  3. Aguardic fetches the email content, metadata, and attachments
  4. The governance engine evaluates against bound policies
  5. Labels are applied or the email is quarantined based on the enforcement mode

Aguardic automatically creates the "Aguardic Quarantine" and "Aguardic Violation" labels in your Gmail account when the first violation is detected.

What Gets Evaluated

  • Email subject — Check for sensitive keywords or naming patterns
  • Email body — Scan content for PII, confidential data, or policy violations
  • Attachments — File names, types, and content of attached files
  • Sender and recipients — Email addresses of all parties
  • Direction — Whether the email is inbound or outbound

Example Policies

Outbound PII Detection

Prevent sensitive personal data from being sent externally:

  • Field: body
  • Operator: MATCHES
  • Value: (\b\d{3}-\d{2}-\d{4}\b|\b\d{9}\b) (SSN patterns)
  • Severity: CRITICAL

Attachment Scanning

Block emails with potentially dangerous attachment types:

  • Field: attachments
  • Operator: MATCHES
  • Value: \.(exe|bat|cmd|ps1|vbs|js)$
  • Severity: HIGH

Unauthorized External Communication

Flag emails sent to non-approved external domains:

  • Field: recipients
  • Operator: NOT_IN
  • Value: @yourcompany.com,@approved-vendor.com
  • Severity: MEDIUM

Next Steps