Skip to content
Back to skills

Gmail

ASecurity

Read, search, and send Gmail emails. Use when the user mentions email, inbox, Gmail, or asks to check/send messages.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 9, 2026
ai-agentspythongoshellbash

Security analysis

A100/100

Scanned December 5, 2026

npx -y skills add julienR2/jarvis --skill gmail --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Gmail?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Gmail
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/julienr2-gmail/badge)](https://www.skillsdirectory.com/skills/julienr2-gmail)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: gmail
description: Read, search, and send Gmail emails. Use when the user mentions email, inbox, Gmail, or asks to check/send messages.
allowed-tools: Bash, Read, Write
---

# Gmail Skill

Access Gmail via IMAP (read/search) and SMTP (send).

## Credentials

Uses the **`gmail`** connector → sets `$GMAIL_ADDRESS`, `$GMAIL_APP_PASSWORD`. Load them per *Connectors* in CLAUDE.md, in the same shell block as the commands that use them.

- **IMAP:** `imaps://imap.gmail.com:993`
- **SMTP:** `smtp://smtp.gmail.com:587` (STARTTLS)

---

In the agent's sandbox, IMAP and SMTP go through its SOCKS proxy: the curl
lines below pass `$FTP_PROXY` when it's set, and Python uses the drop-in
classes from the connectors skill's `sandbox_net.py` (a no-op outside it).

## Read / Search emails (IMAP via curl)

### List latest emails in INBOX

```bash
curl -s ${FTP_PROXY:+--proxy "$FTP_PROXY"} --url "imaps://imap.gmail.com:993/INBOX" \
  --user "${GMAIL_ADDRESS}:${GMAIL_APP_PASSWORD}" \
  -X "FETCH 1:10 (ENVELOPE)"
```

### Search unread emails

```bash
curl -s ${FTP_PROXY:+--proxy "$FTP_PROXY"} --url "imaps://imap.gmail.com:993/INBOX" \
  --user "${GMAIL_ADDRESS}:${GMAIL_APP_PASSWORD}" \
  -X 'SEARCH UNSEEN'
```

### Fetch a specific message by UID

```bash
curl -s ${FTP_PROXY:+--proxy "$FTP_PROXY"} --url "imaps://imap.gmail.com:993/INBOX;UID=<uid>" \
  --user "${GMAIL_ADDRESS}:${GMAIL_APP_PASSWORD}" \
  -X "UID FETCH <uid> (BODY[])"
```

---

## Better approach: Python script

For anything beyond simple listing, use Python (available in the container):

```python
import email, sys
sys.path.insert(0, "/jarvis/agent/skills/connectors")
from sandbox_net import IMAP4_SSL   # imaplib.IMAP4_SSL, through the sandbox's SOCKS proxy when there is one

GMAIL = "${GMAIL_ADDRESS}"
APP_PW = "${GMAIL_APP_PASSWORD}"

mail = IMAP4_SSL("imap.gmail.com")
mail.login(GMAIL, APP_PW)
mail.select("INBOX")

# Search — e.g. unseen
status, data = mail.search(None, "UNSEEN")
uids = data[0].split()

for uid in uids[-10:]:  # last 10
    _, msg_data = mail.fetch(uid, "(RFC822)")
    msg = email.message_from_bytes(msg_data[0][1])
    print(msg["Subject"], "|", msg["From"])

mail.logout()
```

Run with: `python3 /tmp/gmail_read.py`

---

## Send email (SMTP via Python)

```python
import sys
from email.mime.text import MIMEText
sys.path.insert(0, "/jarvis/agent/skills/connectors")
from sandbox_net import SMTP   # smtplib.SMTP, through the sandbox's SOCKS proxy when there is one

GMAIL = "${GMAIL_ADDRESS}"
APP_PW = "${GMAIL_APP_PASSWORD}"

msg = MIMEText("Body here")
msg["Subject"] = "Subject here"
msg["From"] = GMAIL
msg["To"] = "recipient@example.com"

with SMTP("smtp.gmail.com", 587) as smtp:
    smtp.starttls()
    smtp.login(GMAIL, APP_PW)
    smtp.send_message(msg)
```

---

## Common use cases

| Task | Method |
|---|---|
| List unread emails | IMAP SEARCH UNSEEN |
| Read full email body | IMAP FETCH by UID |
| Search by subject/sender | IMAP SEARCH with criteria |
| Send an email | SMTP with MIMEText |
| List folders/labels | IMAP LIST |

## Notes

- Gmail folders use special names: `[Gmail]/Sent Mail`, `[Gmail]/Trash`, `[Gmail]/All Mail`, `[Gmail]/Starred`
- Spaces in app password are fine — Gmail ignores them
- Always close the IMAP connection after use (`mail.logout()`)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.