Use cases → Email operations
Automate migration of legacy mailboxes with delegation
Move mail from legacy systems into Workspace accounts at scale using a delegated service account and the Gmail API.
| Who it is for | IT admins consolidating legacy mail platforms into Google Workspace for dozens or hundreds of users. |
|---|---|
| APIs | Gmail API |
| Typical scopes | gmail.insert, gmail.readonly |
The problem
Manual mailbox migrations are slow, error-prone and impossible to monitor across large user sets. Bulk tools often require direct user credentials, which is unmanageable at scale and violates security policies.
How it works
- Authenticate as a service account with domain-wide delegation.
- Iterate through the list of users and impersonate each target mailbox.
- Read messages from the legacy system and transform them to RFC822 format.
- Insert messages into the target mailbox using the Gmail API’s insert method, preserving original timestamps and labels.
- Track progress and retry any failed inserts by message ID.
What changes
Mailboxes are migrated automatically, with no user involvement, and all historical mail lands in the correct Workspace account with original metadata intact.
Watch it explained
“Google Workspace to Microsoft 365 | Complete Step-by-Step Migration” — Ahmed Masoud on YouTube. Third-party video, included because it covers this ground well. We are not affiliated with the channel.
Questions people ask
Does this preserve original send dates and folder structure?
Yes, the insert method allows you to set the internalDate and labels, but you must map legacy folders to Workspace labels yourself.
How do I monitor which messages failed?
Track response codes for every insert and log message-IDs. Reconcile source and target counts to catch silent skips due to deduplication.
Want this built?
This is a pattern we run in production. We will set up the delegation and build this on top of it — $500 per hour, most of it working the same day.
Talk to us Or read the setup guideRelated use cases
Draft replies automatically in a shared inbox
A delegated service account reads an incoming enquiry, drafts a researched reply in the mailbox, and leaves it for a human to approve and send.
Triage and route inbound mail across a domain
Classify every inbound message, label it, and forward the ones that matter to the person who owns them — without touching a single mail rule.
Send mail as a shared alias from automation
Deliver notifications, confirmations and campaign replies from a branded address like support@ or updates@ without a human in the loop.