Architecture
2 min read • 298 wordsHow go-mapi’s three-component design bridges Windows MAPI to Gmail.
go-mapi uses a clean three-component architecture:
┌─────────────────────┐ ┌─────────────────────┐
│ Windows App │ │ Browser Extension │
│ (Explorer, etc.) │ │ (Chrome / Edge) │
│ │ │ │ │ │
│ MAPISendMail() │ │ React Popup UI │
│ ▼ │ │ │ │
│ ┌─────────────┐ │ %TEMP%\go-mapi\ │ ┌───────────┐ │
│ │ go-mapi.dll │────┼──────────────────────┤ │ Gmail API │ │
│ └─────────────┘ │ ▲ │ └───────────┘ │
└─────────────────────┘ │ └─────────────────────┘
│
┌──────────┴──────────┐
│ Native Messaging │
│ Host (Go binary) │
│ Watches folder │
└─────────────────────┘Components
| Component | Technology | Purpose |
|---|---|---|
| Interceptor DLL | C++ (MinGW) | Captures MAPI calls, writes JSON to temp folder |
| Native Host | Go | Watches folder, bridges to browser via Native Messaging |
| Browser Extension | React + TypeScript | UI + Gmail API integration |
How It Works
- A Windows app calls
MAPISendMail()(e.g., right-click → “Send to” → “Mail recipient”) - go-mapi.dll intercepts the call and writes a JSON file to
%TEMP%\go-mapi\ - The native messaging host watches this folder and relays new messages to the browser
- The browser extension receives the message and creates a Gmail draft via the Gmail API
- The user reviews the draft in the extension popup and clicks “Send” or “Save as Draft”
Why This Design?
- Enterprise-friendly — DLL and host installed once with admin rights; extension updates independently
- Simple OAuth — Extension uses Chrome Identity API, no separate auth flow
- Cross-browser — Same extension works in Chrome and Edge
- Debuggable — JSON files on disk make the IPC trivially inspectable
- No cloud dependency — Everything runs locally, no data leaves your machine
Source Code
All components are in the go-mapi repository :
go-mapi/
├── dll/ # C++ MAPI interceptor DLL
├── host/ # Go native messaging host
├── extension/ # React + TypeScript browser extension
└── scripts/ # PowerShell installer