Gmail Email Drafter
Draft and send emails via Gmail using Google CLI. Analyzes your sent mail for tone matching, composes context-aware drafts, and creates Gmail drafts ready to send. Prerequisites: gcloud, curl, jq, base64.
MCP get_skill({ skillId: "gmail-email-drafter-4c2d7e78" })Use this skill with your agent
Create a free account and connect via MCP
# Gmail Email Drafter
Draft professional emails that match your writing style using Gmail API via Google CLI. Creates drafts in your Gmail account ready for review and sending.
## When to Use
- "Draft an email to [person] about [topic]"
- "Write a reply to [person]'s last email"
- "Compose a follow-up email about [project]"
## Requirements
- **Google Cloud CLI** (`gcloud`) installed and authenticated
- Gmail API enabled in Google Cloud project
- OAuth2 credentials with `gmail.compose`, `gmail.readonly` scopes
- `jq` for JSON parsing
## Workflow
### Step 1 — Authenticate & Verify Access
```bash
# Verify gcloud is authenticated
gcloud auth list
# Get access token for Gmail API
ACCESS_TOKEN=$(gcloud auth print-access-token)
# Verify Gmail access
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
"https://gmail.googleapis.com/gmail/v1/users/me/profile" | jq '.emailAddress'
```
If authentication fails, run:
```bash
gcloud auth login --scopes=https://www.googleapis.com/auth/gmail.compose,https://www.googleapis.com/auth/gmail.readonly
```
### Step 2 — Analyze Tone from Sent Mail
Pull the user's recent sent emails to learn their writing style:
```bash
# Fetch last 5 sent emails
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
"https://gmail.googleapis.com/gmail/v1/users/me/messages?q=in:sent&maxResults=5" | jq '.messages[].id'
# For each message ID, fetch the full content
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
"https://gmail.googleapis.com/gmail/v1/users/me/messages/{MESSAGE_ID}?format=full" | \
jq '{subject: (.payload.headers[] | select(.name=="Subject") | .value), to: (.payload.headers[] | select(.name=="To") | .value)}'
```
Analyze patterns:
- **Greeting style** — "Hi", "Hello", "Dear", or direct (no greeting)
- **Structure** — short paragraphs vs. bullet lists
- **Sign-off** — "Best", "Thanks", "Regards", full name vs. first name
- **Formality level** — professional, friendly-professional, casual
### Step 3 — If Replying, Fetch the Original Thread
```bash
# Search for emails from the recipient
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
"https://gmail.googleapis.com/gmail/v1/users/me/messages?q=from:{RECIPIENT_EMAIL}&maxResults=3" | jq '.messages[].id'
# Get thread context
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
"https://gmail.googleapis.com/gmail/v1/users/me/threads/{THREAD_ID}?format=full" | jq '.messages[-1]'
```
### Step 4 — Compose the Draft
1. Apply the user's discovered tone and style
2. Structure: context → main point → call to action
3. Keep under 200 words unless the user requests more detail
4. Present the draft to the user for review in markdown format
### Step 5 — Create Gmail Draft
After user approves the draft:
```bash
# Base64url encode the email
EMAIL_CONTENT=$(cat <<'EOF'
From: me
To: {RECIPIENT}
Subject: {SUBJECT}
Content-Type: text/plain; charset=utf-8
{BODY}
EOF
)
ENCODED=$(echo -n "$EMAIL_CONTENT" | base64 -w 0 | tr '+/' '-_' | tr -d '=')
# Create draft in Gmail
curl -s -X POST -H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"message\": {\"raw\": \"$ENCODED\"}}" \
"https://gmail.googleapis.com/gmail/v1/users/me/drafts"
```
### Step 6 — Confirm
Report back: "Draft created in Gmail. Open Gmail to review and send."
Provide the draft ID for reference.
## Important Rules
- **Never send emails directly** — only create drafts for user review
- Always show the full email to the user before creating the draft
- If tone analysis fails, fall back to professional defaults
- Never include sensitive data from unrelated email threads
## Example Prompts
- "Draft an email to sarah@acme.com about the project deadline"
- "Write a follow-up to my last conversation with John about the contract"
- "Compose a cold intro email to the VP of Engineering at TechCorp"Related Skills
More skills in Email & Communication
Gmail Cold Outreach Campaign
Research prospects via Brave Search, compose personalized cold outreach emails, and create ready-to-send Gmail drafts with A/B subject line variants. Prerequisites: gcloud, curl, jq, base64, brave-search MCP.
Gmail Follow-Up Tracker
Scans your Gmail sent folder for unanswered emails, identifies stale threads, and creates follow-up drafts with context-aware nudges via Google CLI. Prerequisites: gcloud, curl, jq.
Gmail Inbox Daily Summary
Fetches today's unread Gmail messages via Google CLI, categorizes them by priority, and generates an actionable daily email briefing. Prerequisites: gcloud, curl, jq.
Gmail Label & Filter Organizer
Analyzes your Gmail inbox, creates label taxonomy, and sets up filters to auto-sort incoming mail using Gmail API via Google CLI. Prerequisites: gcloud, curl, jq.
Gmail Response Template Manager
Creates, stores, and applies reusable email response templates. Analyzes your common replies to build a template library, then auto-fills templates for quick Gmail draft creation. Prerequisites: gcloud, curl, jq, base64.
Meeting Notes to Gmail Summary
Converts meeting notes or transcripts into structured summary emails and creates Gmail drafts addressed to all attendees. Prerequisites: gcloud, curl, jq, base64.
Explore Other Categories
Skills from other categories with shared topics
Apology Message Crafter
Crafts sincere, effective apology messages using the structured apology framework (acknowledge, take responsibility, make amends). Researches context-specific advice and provides multiple tone options. Prerequisites: brave-search MCP.
Difficult Conversation Prep Coach
Prepares scripts and strategies for hard conversations using frameworks (Nonviolent Communication, DESC). Researches situation-specific advice via Brave Search and provides word-for-word scripts with fallback responses. Prerequisites: brave-search MCP.
Newsletter Issue Writer
Researches trending topics via Brave Search, curates links, and writes a complete newsletter issue with engaging subject lines, sections, and CTAs. Prerequisites: brave-search MCP, python3.