AI Email Scanning

AI-powered email scanning
Resmo Email Scanning checks your emails to find where you might have signed up for new accounts. It looks for emails that are about joining or subscribing to something. This way, you can easily see what accounts you've made through emails and manage them with Resmo.

How the Scan Process Works

Currently, email scanning supports Google Workspace only.
The first step in the process is downloading Gmail emails for all users in your organization. To achieve this step successfully you will need to create a service account and configure domain-wide delegation for this account.

How to Create a Service Account

  • Credentials and super admin rights are required in Google Workspace is provided by service account.
  • To configure service account, you can check documentation from here.
  1. 1.
    Open the Google Cloud Console (
  2. 2.
    Select a project. If there are no existing projects, create a project.
  3. 3.
    Enable the API.
  • On the navigation menu, select API & Services > Library option if it is not already selected.
  • In the displayed list of APIs, click Admin SDK API and Gmail API . Enable these options if they are not already enabled.
  1. 4.
    On the navigation menu, select Credentials.
  2. 5.
    To create a new service account click Create Credentials.
    • From the drop-down menu, select Service Account.
    • Enter the account name. The ID is automatically populated.
    • To furnish a new private key, select the json key type.
    • Click Create. You are prompted to download the key.

How to Add Domain-Wide Delegation

  • Domain-wide delegation provides credentials are required to read all emails.
  • To configure domain-wide delegation, you can check documentation from here.
  1. 1.
    Sign in to your Google Admin console. Sign in using an account with super administrator privileges (does not end in
  2. 2.
    In the Admin console, go to Menu -> Security -> Access and data control -> API controls -> Manage Domain Wide Delegation.
You must be signed in as a super administrator for this task.
  1. 3.
    Click Add new and enter your service account client ID.
  • You can find the ID (also known as the Unique ID) in the JSON file that you downloaded when you created the service account or in Google Cloud (click IAM & Admin -> Service accounts -> the name of your service account).
  1. 4.
    Enter the client ID of the service account or OAuth2 client ID of the app.
  2. 5.
    In OAuth Scopes, add each scope that the application can access.
  1. 6.
    Click Authorize.
  2. 7.
    Point to the new client ID, click View details, and make sure that every scope is listed. If a scope is not listed, click Edit, enter the missing scope, and click Authorize. You can't edit the client ID.
After that, AI takes part in the process to achieve the best results in identifying possible account creations from emails. The scan process uses AI-based classification practices and labels emails into several categories. With the help of labeling, unrelated emails eliminated and the others processed in Resmo as related users and apps.

How to Use

# Ensure you have git and Python 3.7 installed in your environment. AI Labeling can take time.
# Clone the repository
$ git clone
# Install the dependencies
$ cd email-app-scanner
$ pip install -r requirements.txt
# Set variables
ADMIN_EMAIL="[email protected]"
# Run the code for downloading emails for all users, it will take a while depending on your internet connection and number of users
$ python \
--admin-email $ADMIN_EMAIL \
--service-account $SERVICE_ACCOUNT
# Run the code for AI labeling emails for all users. It's recommended to use a machine with GPU for this step. It will take a while depending on your machine and number of users
$ python
# After the execution is done, you can see the results in the JSON file
# To upload this file to Resmo, run the following code
$ python --ingest-key $INGEST_KEY
You can see results in Resmo by checking accounts with email sources: