← Back to Skills Marketplace
scottgl9

Gmail IMAP

by scottgl9 · GitHub ↗ · v1.1.1 · MIT-0
cross-platform ✓ Security Clean
67
Downloads
2
Stars
0
Active Installs
8
Versions
Install in OpenClaw
/install gmail-imap
Description
Read, search, send, trash, move, and label Gmail via IMAP. Requires GMAIL_IMAP_USER (Gmail address) and GMAIL_IMAP_PASSWORD (Google App Password) environment...
README (SKILL.md)

Gmail IMAP Skill

All Gmail access uses IMAP. Credentials are read from environment variables — never printed.

Requirements

Set these environment variables before use:

Variable Description
GMAIL_IMAP_USER Your Gmail address (e.g. [email protected])
GMAIL_IMAP_PASSWORD A Google App Password (not your account password)

Generate an App Password at: https://myaccount.google.com/apppasswords (requires 2FA enabled)

Quick Reference

# Locate the script (adjust SKILL_DIR to match your install location):
# Default: ~/.openclaw/skills/gmail-imap
# Custom:  \x3Cworkspace>/skills/gmail-imap
SCRIPT="$SKILL_DIR/scripts/gmail_imap.py"

# List inbox (most recent 20)
"$SCRIPT" list

# List with custom limit
"$SCRIPT" list --limit 50

# List unread only (shorthand)
"$SCRIPT" list --unread

# List unread with limit
"$SCRIPT" list --unread --limit 10

# Search by sender (IMAP header search)
"$SCRIPT" list --search 'FROM "[email protected]"'

# Full-text search (Gmail X-GM-RAW — searches body + headers)
"$SCRIPT" search "invoice"
"$SCRIPT" search "from:[email protected] is:unread" --limit 5
"$SCRIPT" search "subject:meeting this week"

# Read a message (by UID shown in list output)
"$SCRIPT" read \x3Cuid>

# Read from a specific folder
"$SCRIPT" read \x3Cuid> --folder "[Gmail]/All Mail"

# Delete (moves to [Gmail]/Trash — correct Gmail deletion)
"$SCRIPT" trash \x3Cuid>

# Move to a label/folder
"$SCRIPT" move \x3Cuid> "Work"

# Send email
"$SCRIPT" send --to [email protected] --subject "Hello" --body "Message text"

Deletion Rule (Critical)

Never use the standard IMAP \Deleted flag on Gmail — it only archives, it does not delete. Always use trash \x3Cuid> which moves to [Gmail]/Trash. The script handles this correctly.

Credentials

Set in env (never output raw password):

  • GMAIL_IMAP_USER — Gmail address
  • GMAIL_IMAP_PASSWORD — App password (generate at myaccount.google.com/apppasswords)

Reference

For folder names, search syntax, direct Python IMAP usage, and connection details: → See references/gmail-imap-reference.md

Usage Guidance
This skill appears coherent and implements Gmail access using IMAP/SMTP as described. Before installing: (1) provide a dedicated Google App Password (not your main password) and enable 2FA; (2) prefer creating a separate app password for this skill so you can revoke it later; (3) review the included script yourself if you want to verify it won’t log or transmit credentials (the script does not print the password, but it will connect to Google servers and thus has access to your mail); (4) be aware that the agent can access and modify your email (read/delete/send) when invoked — only enable/use the skill for trusted agents and consider revoking the app password when no longer needed. If you want deeper assurance, provide the full (untruncated) script for a line-by-line review or run it in a controlled environment first.
Capability Tags
requires-sensitive-credentials
Capability Assessment
Purpose & Capability
Name/description ask for Gmail IMAP access and the skill only requires GMAIL_IMAP_USER and GMAIL_IMAP_PASSWORD. The script uses imap.gmail.com and smtp.gmail.com and implements listing, searching, reading, trashing, moving, labeling, and sending — all consistent with the description.
Instruction Scope
SKILL.md instructs the agent to run the included script and to set the two environment variables. The instructions and script operate on IMAP/SMTP only and don't instruct reading unrelated files, contacting other endpoints, or exfiltrating data to third-party servers.
Install Mechanism
No install spec is provided (instruction-only). The skill ships a Python script that uses only standard libraries (imaplib, smtplib, email). No external downloads or package installs are requested.
Credentials
The skill requires exactly two environment variables: an email address and a Google App Password (declared as the primary credential). Those are proportionate and necessary for IMAP/SMTP access. No unrelated secrets or config paths are requested.
Persistence & Privilege
always is false and disable-model-invocation is false (normal). The skill does not request system-wide config changes or persist credentials beyond using the provided env vars at runtime.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install gmail-imap
  3. After installation, invoke the skill by name or use /gmail-imap
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.1.1
Fix: search results table now displays correctly (was using fetch instead of uid FETCH for UID-based search results). Fix: folder names with spaces/brackets (e.g. [Gmail]/All Mail) now properly quoted for IMAP.
v1.1.0
Add: search subcommand with full-text Gmail X-GM-RAW support (searches body+headers using Gmail's own search syntax). Add --unread shorthand to list. Add --limit to search. Add --folder to read and trash. Fix: print_message_list shared helper, empty result handling.
v1.0.5
Make script directly executable (#!/usr/bin/env python3 shebang); invoke as $SCRIPT list instead of python3 $SCRIPT list. Allows adding script path to exec approvals without needing python3 approval.
v1.0.4
Add metadata.openclaw with requires.env (GMAIL_IMAP_USER, GMAIL_IMAP_PASSWORD), primaryEnv, bins, and homepage to fix scanner flag.
v1.0.3
Add README.md with author credit (Scott Glover), usage examples, and license.
v1.0.2
Fix: use $SKILL_DIR variable instead of hardcoded absolute path to script; portable across install locations.
v1.0.1
Fix: move credential requirements (GMAIL_IMAP_USER, GMAIL_IMAP_PASSWORD) to top of description and add prominent Requirements section to resolve scanner warning.
v1.0.0
Initial publish — Gmail IMAP helper for OpenClaw agents. Read, search, send, trash, move, and label Gmail messages via IMAP. Credentials via GMAIL_IMAP_USER and GMAIL_IMAP_PASSWORD env vars.
Metadata
Slug gmail-imap
Version 1.1.1
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 8
Frequently Asked Questions

What is Gmail IMAP?

Read, search, send, trash, move, and label Gmail via IMAP. Requires GMAIL_IMAP_USER (Gmail address) and GMAIL_IMAP_PASSWORD (Google App Password) environment... It is an AI Agent Skill for Claude Code / OpenClaw, with 67 downloads so far.

How do I install Gmail IMAP?

Run "/install gmail-imap" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Gmail IMAP free?

Yes, Gmail IMAP is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Gmail IMAP support?

Gmail IMAP is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Gmail IMAP?

It is built and maintained by scottgl9 (@scottgl9); the current version is v1.1.1.

💬 Comments