Skip to content

rubensbraz/BridgeMail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BridgeMail v1.0 | E-mail Translation Engine

Build Status Google Apps Script Gmail Google Sheets License


📖 Overview

BridgeMail is a high-performance email translation engine built for Google Workspace. It automates the monitoring, translation, and re-dispatching of international communications. Unlike simple scripts, BridgeMail follows Enterprise Design Patterns, utilizing an optimized $O(1)$ search strategy for audit logs and an intelligent HTML-safe chunking mechanism.

🖼️ System Preview

Audit & Tracking Dashboard

Audit Log Preview Log sheet with processing metrics and status tracking.

Centralized Configuration

Settings Preview Dynamic settings sheet.

E-mail examples


🌟 Key Features

  • HTML-Safe Chunking: Slices large email bodies into translatable fragments without breaking HTML tags, ensuring the visual integrity of the original layout.
  • Resilience via Exponential Backoff: Automatic retry logic with increasing delays ($delay = base \times 2^{n}$) to handle Google Service rate limits.
  • High-Performance Deduplication: Uses a Set-based cache for $O(1)$ lookup complexity, preventing duplicate translations even in massive inboxes.
  • Smart Merge Setup: One-click infrastructure deployment that preserves existing user data while updating system headers and protections.
  • Multi-Language Orchestration: Support for multiple target languages in a single execution, generating a unified multi-lingual response.
  • Execution Time Guard: Self-monitoring system that breaks processing loops before hitting Google's 6-minute script execution limit.

🔄 System Architecture

graph TD
    Trigger[Time-Based Trigger] --> Engine[Translation Engine]
    Engine -->|Loads| Config[Config Manager]
    Engine -->|Queries| Gmail[Gmail API]
    Gmail -->|Fetched Threads| Engine
    Engine -->|Checks| Audit[Audit Manager]
    Audit -->|Set Cache Lookup| Engine
    Engine -->|Delegates| Service[Translation Service]
    Service -->|Backoff & Chunking| LangApp[Google LanguageApp]
    Engine -->|Logs Result| Audit
    Engine -->|Dispatches| SMTP[Gmail App Send]
Loading

🛠️ Project Structure

BridgeMail/
├── translator.gs              # Main Engine: Orchestration, Translation & Audit
├── send_test.gs               # Test Tool: Generates a Japanese HTML e-mail
├── docs/
│   ├── images/                # Screenshots of the Sheets interface
│   └── email_examples/        # PDF examples (Original vs Translated)

🚀 Quick Start

Prerequisites

  • A Google account.

Installation & Deployment

You can set up BridgeMail in two ways. The recommended method saves time and ensures all formatting, data validation, and cell protections are correctly applied.

Option A: Using the Official Template (Recommended)

  1. Access the Template: Open the BridgeMail Master Spreadsheet.
  2. Duplicate the File: Go to File > Make a copy. This creates your own private instance of the engine.
  3. Configure Parameters: Access the Settings tab and fill in the required values (emails, language codes, etc.).
  4. Install Automation: From the top menu, click BridgeMail > Refresh Trigger Automation. This activates the background monitoring.

Option B: Manual Configuration

  1. Create Spreadsheet: Open a new Google Sheet.
  2. Access Apps Script: Go to Extensions > Apps Script.
  3. Paste the Code: Create translator.gs and send_test.gs files and paste the respective contents.
  4. Initialize System: Refresh the spreadsheet page and go to the BridgeMail menu > Setup System.
  5. Settings: Fill in the Settings sheet generated by the setup process.
  6. Activate Trigger: Go to the menu BridgeMail > Refresh Trigger Automation.

🔐 Security & Permissions

When you run BridgeMail for the first time, Google will request permissions to access your Gmail, Sheets, and Translation services.

Note: You might see a "Google hasn't verified this app" screen. This is normal for private scripts. Click Advanced > Go to BridgeMail (unsafe) to proceed. The script runs entirely within your account; no data is shared with third parties except for the Google Translation API.


🔍 Troubleshooting

Issue Potential Cause Solution
Script Timeout BATCH_LIMIT is too high or emails are too large. Lower BATCH_LIMIT or MAX_CHAR_LIMIT.
Quota Exceeded Daily translation limit reached. Google limits free tier translations. Wait 24h.
No Emails Found SEARCH_QUERY is too restrictive. Test your query directly in the Gmail search bar.
Wrong Layout HTML tags in source are malformed. BridgeMail attempts to fix this, but check the source.

⚖️ License (CC BY-NC 4.0)

This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License.

CC BY-NC 4.0

Summary of Terms

  • Attribution: You must give appropriate credit to the author.
  • NonCommercial: You may NOT use the material for commercial purposes.
  • Adaptation: You can remix and build upon the material.

👨‍💻 Author

Rubens Braz

About

Automated Gmail translator for Google Apps Script. Supports HTML and plain text translation with layout preservation and audit logging.

Topics

Resources

Stars

Watchers

Forks

Contributors