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
Log sheet with processing metrics and status tracking.
- 📄 Original Email (Japanese): The source payload.
- 📄 Translated Result: The final multi-language delivery.
- 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.
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]
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)
- A Google account.
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.
- Access the Template: Open the BridgeMail Master Spreadsheet.
- Duplicate the File: Go to
File>Make a copy. This creates your own private instance of the engine. - Configure Parameters: Access the
Settingstab and fill in the required values (emails, language codes, etc.). - Install Automation: From the top menu, click BridgeMail > Refresh Trigger Automation. This activates the background monitoring.
- Create Spreadsheet: Open a new Google Sheet.
- Access Apps Script: Go to
Extensions>Apps Script. - Paste the Code: Create
translator.gsandsend_test.gsfiles and paste the respective contents. - Initialize System: Refresh the spreadsheet page and go to the BridgeMail menu > Setup System.
- Settings: Fill in the
Settingssheet generated by the setup process. - Activate Trigger: Go to the menu BridgeMail > Refresh Trigger Automation.
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.
| 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. |
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License.
- 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.
Rubens Braz

