Connect Claude to multiple Gmail accounts
Claude's built-in email connection links just one Gmail account. Claude Code can connect as many as you like, so this guide uses Claude Code. The one-time setup lets it read, draft and send across every Gmail account you own, with no coding background needed.
Get ready
Start a project folder with a CLAUDE.md
The built-in connection in the Claude app and Cowork handles one inbox. That is why we use Claude Code: it runs on your computer, so it can use a small script and your own Google credentials to reach as many accounts as you like. Everything lives in one folder, and a CLAUDE.md file in it tells Claude how the project works.
- Create an empty folder, for example
claude-email. - Add a CLAUDE.md that says the goal: read, draft and send email across several Gmail accounts, and keep all credentials in a local file that never gets shared.
- Open the folder in Claude Code.
Get ready
Let Claude plan it and set permissions
Ask Claude to plan the whole setup before it writes anything. Then decide what it may do: reading and drafting are low risk, sending is the one to think about.
- Ask: "Plan how to connect my Gmail accounts using the Gmail API. Do not write code yet."
- Approve a plan that covers a small local script, one sign-in per account, and tokens saved on your machine.
- Grant read and draft access first. Add send access only when you want Claude to send for you.
- Once it is built, ask: "Set up my .env file so I can paste in my Google client ID and client secret myself."
Google credentials
Create a Google Cloud project and turn on the Gmail API
Google needs to know your script is allowed to talk to Gmail. That starts with a free Google Cloud project.
- Go to the Google Cloud Console and create a new project.
- Open the API library, search for Gmail API and click Enable. Pick the plain Gmail API, not an MCP listing.
- Optional: search for Calendar and enable it the same way if you want Claude to see your calendar.
Google credentials
Set up the OAuth consent screen
The consent screen is what you see when you sign in and approve access. Since this is only for your own accounts, keep it simple.
- Open the OAuth consent screen, click Get started and give the app a name, such as "My Claude email".
- Choose External as the audience and add your email as the contact.
- Agree to the terms and create it, then open Branding and check your email is the developer contact.
- Add the Gmail scopes you decided on: read, compose and, only if you want it, send.
Google credentials
Create the OAuth client and copy the ID and secret
The client ID and secret are the keys your script uses to start the sign-in. Treat the secret like a password.
- Create credentials, choose OAuth client ID, and pick Desktop app.
- Copy the client ID and client secret. You cannot see the secret again later.
- Paste them into the blank slots in your
.envfile and save it before you close the Google page. If you lose the secret, you have to create a new client. - Ask Claude to add
.envto.gitignore.
# Gmail accounts: one line per account.
# The word after GMAIL_ACCOUNT_ is the nickname you will use, such as work or personal.
GMAIL_ACCOUNT_WORK=you@yourcompany.com
GMAIL_ACCOUNT_PERSONAL=you@gmail.com
# Google OAuth client: paste the values from the Google Cloud Console.
# Type them straight after the equals sign, with no quotes and no spaces.
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=Claude already made a .env in step 2. If its variable names differ from these, keep Claude's names and only fill in the values. To start from this version instead, paste it into your .env and tell Claude to use these names. Replace the example emails with your own.
Can't see your .env file? (Mac)
Files that start with a dot are hidden by default. Open your project folder in Finder and press Command + Shift + . (period) to show them. Press it again to hide them.
Google credentials
Add your accounts as test users
While the app is in testing, only listed accounts can sign in. Add every Gmail address you want Claude to reach.
- Open the Audience section of the consent screen.
- Add each Gmail address under Test users and save. You may need to save more than once, so check that every address shows in the list.
Connect and use it
Sign in and authorize each account
Now Claude runs the sign-in once per account. A browser window opens, you pick the account and approve access.
- Ask Claude to run the sign-in for your first account.
- Pick the account and approve. If Google warns the app is unverified, that is expected for your own test app.
- Repeat for each additional account.
Connect and use it
Make it a skill
A skill is a saved set of instructions Claude loads when it needs it. Turning the setup into one means you can just ask for your email later, without naming the tool.
- Ask: "Turn this Gmail setup into a skill that runs automatically whenever I ask about email in any of my accounts."
- Ask it to confirm with you before it sends anything.
- Read what it created and approve it.
Connect and use it
Test it in a new session
Start a fresh session in the same project folder, because that is where the code lives. Then ask in plain English. Claude calls the script for each account and combines the results.
- Open a new session on the project folder.
- Try: "Summarize every unread email across all my accounts, grouped by account."
- Ask a follow-up, such as which ones need a reply today.
Connect and use it
Draft a reply in your own voice
Give Claude a sample or two of how you write, then ask for a draft. It saves the draft in Gmail so you can review it before anything goes out.
- Paste a short email you wrote that sounds like you.
- Say: "Draft a reply to the second message in that voice. Save it as a draft, do not send."
- Open Gmail, check the draft and send it yourself.
Start with the free starter file
A ready-made CLAUDE.md for this project, so Claude knows the goal, the permissions and the safety rules from the first message.
CLAUDE.md starter filePlan first, credentials out of git, nothing sent without your say-so.