This Google Workspace Add-on provides a simple, configurable interface within Gmail for users and administrators to submit emails for reclassification to a Cloudflare Email Security account.
- One-Click Submissions: Allows users to reclassify an email with a single click directly from the Gmail sidebar.
- Configurable Classifications: Administrators can define which submission categories are available.
- Role-Based Permissions: Display different, more advanced submission options for security administrators or investigators.
- Undo Functionality: Provides a 15-second "undo" window after a submission is made to prevent accidental clicks.
- Automated Post-Actions: Automatically moves emails to Trash, Spam, or Inbox after a successful submission.
- Intelligent "Safe" Handling: Automatically retrains both Cloudflare and Gmail filters when a message in the Spam folder is marked as safe.
Follow these steps to deploy and configure the add-on for your Google Workspace domain.
- Navigate to Google Apps Script.
- Click New project. Give the project a name (e.g., "Cloudflare Email Submission").
- You will see a Code.gs file. Replace its contents with the code from the Code.gs file in this repository.
- In the editor settings (⚙️), check the box for "Show 'appsscript.json' manifest file in editor".
- A new appsscript.json file will appear. Replace its contents with the code from the appsscript.json file in this repository.
- Click the Save project icon (💾).
The add-on needs permission to check a user's admin role to determine if they should see advanced options.
- In the Apps Script editor, go to the Services section on the left sidebar (the + icon).
- Click + Add a service.
- From the list, find and select Admin SDK API.
- Click Add. This will enable the AdminDirectory object used in the code.
This add-on uses a custom role to identify which users are "Admins" or "Investigators". This role does not need any permissions assigned to it; it is used only as a tag.
- Go to your Google Workspace Admin Console (admin.google.com).
- Navigate to Account > Admin roles.
- Click Create new role.
- Give it a name (e.g., Email Security Investigator) and a description.
- Click Continue.
- On the "Admin console privileges" page, DO NOT select any permissions.
- Click Continue, then click Create Role.
- After creating the role, assign it to your security administrators or investigators who need to see the "Team" submission options.
- In the Apps Script editor, click the Deploy button > New deployment.
- Click the gear icon next to "Select type" and choose Add-on.
- Provide a description for the deployment.
- Under Installation, choose Admin install for domain-wide deployment.
- Click Deploy.
The add-on will now be installed and available in the right-hand sidebar for all users in your domain.
The final configuration is done by an administrator directly within the Gmail interface.
- Open Gmail and click the add-on icon in the right-hand sidebar.
- The "One-Click Forwarder Setup" card will appear.
- Enter your unique Cloudflare Email Security Account ID.
- From the dropdown list, select the custom admin role you created in Step 3.
- Configure the Visibility and Post-Action for each of the six classifications to match your organization's policies.
- Click Save Settings.
The add-on is now fully configured and ready for users.
- Open any email in Gmail.
- Click the add-on icon in the right-hand sidebar to open it.
- Select the desired classification from the list.
- Click the "Submit Classification" button.
- A confirmation will appear with a 15-second countdown and an "Undo" button, allowing the user to cancel the action if a mistake was made.