email

Email operations skill for sending, fetching, and reading emails via IMAP/SMTP. Uses curl with OpenSSL/LibreSSL for reliable TLS compatibility with Tencent Enterprise Mail and other providers. Credentials are securely stored in macOS Keychain.

242 stars

Best use case

email is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Email operations skill for sending, fetching, and reading emails via IMAP/SMTP. Uses curl with OpenSSL/LibreSSL for reliable TLS compatibility with Tencent Enterprise Mail and other providers. Credentials are securely stored in macOS Keychain.

Email operations skill for sending, fetching, and reading emails via IMAP/SMTP. Uses curl with OpenSSL/LibreSSL for reliable TLS compatibility with Tencent Enterprise Mail and other providers. Credentials are securely stored in macOS Keychain.

Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.

Practical example

Example input

Use the "email" skill to help with this workflow task. Context: Email operations skill for sending, fetching, and reading emails via IMAP/SMTP.
Uses curl with OpenSSL/LibreSSL for reliable TLS compatibility with Tencent Enterprise Mail and other providers.
Credentials are securely stored in macOS Keychain.

Example output

A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.

When to use this skill

  • Use this skill when you want a reusable workflow rather than writing the same prompt again and again.

When not to use this skill

  • Do not use this when you only need a one-off answer and do not need a reusable workflow.
  • Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/email/SKILL.md --create-dirs "https://raw.githubusercontent.com/aiskillstore/marketplace/main/skills/7sageer/email/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/email/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How email Compares

Feature / AgentemailStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Email operations skill for sending, fetching, and reading emails via IMAP/SMTP. Uses curl with OpenSSL/LibreSSL for reliable TLS compatibility with Tencent Enterprise Mail and other providers. Credentials are securely stored in macOS Keychain.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Email Operations Skill

## Overview

This skill provides email capabilities through direct IMAP/SMTP protocol access using curl. It supports:
- **Sending emails** via SMTP with TLS
- **Fetching email lists** via IMAP
- **Reading email content** by ID
- **Multi-account support** with secure credential storage

## Architecture

- **Protocol**: Direct IMAP (port 993) and SMTP (port 465) over TLS
- **Security**: Passwords stored in macOS Keychain, never in config files
- **Compatibility**: Uses curl with OpenSSL/LibreSSL (better Tencent Enterprise Mail support than rustls)
- **Configuration**: YAML-based account management in `references/accounts.yaml`

## Available Scripts

### 1. Send Email (`send-email.sh`)

Send emails via SMTP with support for inline or file-based content.

**Usage:**
```bash
./scripts/send-email.sh -t recipient@example.com -s "Subject" -b "Message"
./scripts/send-email.sh -t recipient@example.com -s "Subject" -f message.txt
./scripts/send-email.sh -t recipient@example.com -c another@example.com -s "Subject" -b "Message"
```

**Parameters:**
- `-a ACCOUNT` - Account name (default: from accounts.yaml)
- `-t EMAIL` - Recipient email (required)
- `-c EMAIL` - CC recipient (optional)
- `-s TEXT` - Email subject (required)
- `-b TEXT` - Email body inline (required if no -f)
- `-f FILE` - Email body from file (required if no -b)

### 2. Fetch Emails (`fetch-emails.sh`)

Retrieve email headers from a mailbox.

**Usage:**
```bash
./scripts/fetch-emails.sh                    # Fetch 10 latest from INBOX
./scripts/fetch-emails.sh -n 20              # Fetch 20 latest
./scripts/fetch-emails.sh -m "Sent"          # Fetch from Sent folder
```

**Parameters:**
- `-a ACCOUNT` - Account name (default: from accounts.yaml)
- `-m FOLDER` - Mailbox folder (default: INBOX)
- `-n N` - Number of emails to fetch (default: 10)

### 3. Read Email (`read-email.sh`)

Read full content of a specific email by ID.

**Usage:**
```bash
./scripts/read-email.sh 123                   # Read full email
./scripts/read-email.sh -p HEADER 123         # Headers only
./scripts/read-email.sh -p BODY 123           # Body only
```

**Parameters:**
- `-a ACCOUNT` - Account name (default: from accounts.yaml)
- `-m FOLDER` - Mailbox folder (default: INBOX)
- `-p PART` - Part to retrieve: HEADER, BODY, or TEXT (default: TEXT)
- `EMAIL_ID` - Email ID (required, positional argument)

## Configuration

### Account Setup

Edit `references/accounts.yaml` to add email accounts:

```yaml
default_account: SUSTech

accounts:
  SUSTech:
    email: qihr2022@mail.sustech.edu.cn
    display_name: Hanrui Qi
    imap:
      host: imap.exmail.qq.com
      port: 993
      login: qihr2022@mail.sustech.edu.cn
      protocol: imaps
    smtp:
      host: smtp.exmail.qq.com
      port: 465
      login: qihr2022@mail.sustech.edu.cn
      protocol: smtps
```

### Password Management

Passwords are stored in macOS Keychain. Set them using:

```bash
# IMAP password
security add-generic-password \
  -a "qihr2022@mail.sustech.edu.cn" \
  -s "email-imap-sustech" \
  -w "your-password" \
  -U

# SMTP password
security add-generic-password \
  -a "qihr2022@mail.sustech.edu.cn" \
  -s "email-smtp-sustech" \
  -w "your-password" \
  -U
```

**Keychain service naming convention:**
- IMAP: `email-imap-{account_name_lowercase}`
- SMTP: `email-smtp-{account_name_lowercase}`

## Common Use Cases

### 1. Send a Quick Email

When user says: "Send an email to alice@example.com about the meeting"

```bash
cd /Users/seven/Claude/.claude/skills/email
./scripts/send-email.sh \
  -t alice@example.com \
  -s "Meeting Discussion" \
  -b "Hi Alice, I wanted to follow up on our meeting..."
```

### 2. Check Recent Emails

When user says: "Check my email" or "Any new emails?"

```bash
cd /Users/seven/Claude/.claude/skills/email
./scripts/fetch-emails.sh -n 5
```

Parse the output and summarize for the user.

#### Search / Filter (Pipe + grep/rg)

This is a lightweight way to "search" within the recent emails that `fetch-emails.sh` fetched (headers only: From/Subject/Date).

```bash
cd /Users/seven/Claude/.claude/skills/email

# 任意关键字(例如 github),同时保留邮件 ID 行(便于后续 read)
./scripts/fetch-emails.sh -n 200 | rg -i "github" -B 2

# 主题关键字(建议用 rg;没有 rg 就用 grep -E)
./scripts/fetch-emails.sh -n 200 | rg "主题:.*会议" -B 2
./scripts/fetch-emails.sh -n 200 | grep -E "主题:.*会议" -B 2

# 发件人关键字
./scripts/fetch-emails.sh -n 200 | rg "发件人:.*alice" -B 1

# 提取匹配到的邮件 ID,然后读取正文(取第一个匹配)
email_id="$(
  ./scripts/fetch-emails.sh -n 200 |
    rg -i "github" -B 2 |
    sed -nE 's/.*邮件 #([0-9]+).*/\1/p' |
    head -n 1
)"
./scripts/read-email.sh "$email_id"
```

If `email_id` is empty, increase `-n` (fetch more recent emails) or adjust the keyword/regex.

### 3. Read Specific Email

When user says: "Read email #3" or "Show me the latest email"

```bash
cd /Users/seven/Claude/.claude/skills/email
./scripts/read-email.sh 3
```

### 4. Email Automation

Combine with other skills for automation:
- Check calendar → Send reminder emails
- Monitor inbox → Create system notifications
- Fetch emails → Parse and extract information

## Error Handling

### Common Issues

1. **Authentication Failed**
   - Verify Keychain passwords are set correctly
   - Check if IMAP/SMTP is enabled in email provider settings
   - For Tencent Enterprise Mail, use app-specific password

2. **Connection Timeout**
   - Verify network connectivity
   - Check firewall settings for ports 993 (IMAP) and 465 (SMTP)
   - Confirm host and port in accounts.yaml

3. **TLS Handshake Failed**
   - This skill uses curl with OpenSSL/LibreSSL for better compatibility
   - If issues persist, check email provider's TLS requirements

## Security Considerations

- **Never log or display passwords** - they're in Keychain only
- **Confirm before sending** - especially for important emails
- **Validate recipients** - check email addresses before sending
- **Respect privacy** - don't read emails unless explicitly requested

## Provider-Specific Notes

### Tencent Enterprise Mail (exmail.qq.com)
- IMAP: imap.exmail.qq.com:993 (SSL/TLS)
- SMTP: smtp.exmail.qq.com:465 (SSL/TLS)
- Requires IMAP/SMTP enabled in settings
- Recommend using app-specific password
- Note: IMAP `SEARCH` for string criteria (e.g. `SUBJECT`/`FROM`/`HEADER`) may be unreliable on some Tencent Exmail servers; prefer client-side filtering via `fetch-emails.sh | rg/grep`.

### Gmail
- IMAP: imap.gmail.com:993
- SMTP: smtp.gmail.com:587 (STARTTLS)
- Requires "Less secure app access" or App Password
- May need OAuth2 for enhanced security

### Outlook/Office 365
- IMAP: outlook.office365.com:993
- SMTP: smtp.office365.com:587
- Requires modern authentication

## Technical Details

### Why curl instead of rustls?

The rustls TLS library has compatibility issues with some email providers (notably Tencent Enterprise Mail). curl with OpenSSL/LibreSSL provides:
- Better TLS handshake compatibility
- Wider cipher suite support
- Proven reliability with enterprise email systems

### IMAP vs POP3

This skill uses IMAP (not POP3) because:
- IMAP supports folder management
- Messages remain on server
- Better for multi-device access
- More flexible search and filtering

## Future Enhancements

Potential improvements (not yet implemented):
- Server-side IMAP SEARCH (subject/sender/date; provider-dependent)
- Attachment handling
- HTML email composition
- Email filtering and rules
- OAuth2 authentication support
- Batch operations

## References

- [RFC 3501 - IMAP4rev1](https://tools.ietf.org/html/rfc3501)
- [RFC 5321 - SMTP](https://tools.ietf.org/html/rfc5321)
- [curl IMAP documentation](https://curl.se/docs/manual.html)
- [macOS Keychain security command](https://ss64.com/osx/security.html)

Related Skills

agent-email-cli

242
from aiskillstore/marketplace

Operate the agent-email CLI to create disposable inboxes, poll for new mail, retrieve full message details, and manage local mailbox profiles. Use when the user needs terminal-based email inbox access for LLM or agent automation workflows.

email-systems

242
from aiskillstore/marketplace

Email has the highest ROI of any marketing channel. $36 for every $1 spent. Yet most startups treat it as an afterthought - bulk blasts, no personalization, landing in spam folders. This skill covers transactional email that works, marketing automation that converts, deliverability that reaches inboxes, and the infrastructure decisions that scale. Use when: keywords, file_patterns, code_patterns.

react-email

242
from aiskillstore/marketplace

Use when creating HTML email templates with React components - welcome emails, password resets, notifications, order confirmations, newsletters, or transactional emails.

email-composer

242
from aiskillstore/marketplace

Draft professional emails for various contexts including business, technical, and customer communication. Use when the user needs help writing emails or composing professional messages.

email-marketing-bible

242
from aiskillstore/marketplace

Comprehensive, data-backed email marketing knowledge base. 908 sources, 4,798 insights. Use when reviewing email setups, building automation flows, diagnosing deliverability, writing email copy, selecting platforms, or pulling benchmarks. Covers strategy, flows, deliverability, copywriting, segmentation, compliance, cold email, and 19 industry playbooks.

email-sequence

242
from aiskillstore/marketplace

When the user wants to create or optimize an email sequence, drip campaign, automated email flow, or lifecycle email program. Also use when the user mentions "email sequence," "drip campaign," "nurture sequence," "onboarding emails," "welcome sequence," "re-engagement emails," "email automation," or "lifecycle emails." For in-app onboarding, see onboarding-cro.

cold-email

242
from aiskillstore/marketplace

Write B2B cold emails and follow-up sequences that get replies. Use when the user wants to write cold outreach emails, prospecting emails, cold email campaigns, sales development emails, or SDR emails. Also use when the user mentions "cold outreach," "prospecting email," "outbound email," "email to leads," "reach out to prospects," "sales email," "follow-up email sequence," "nobody's replying to my emails," or "how do I write a cold email." Covers subject lines, opening lines, body copy, CTAs, personalization, and multi-touch follow-up sequences. For warm/lifecycle email sequences, see email-sequence. For sales collateral beyond emails, see sales-enablement.

email-assistant

242
from aiskillstore/marketplace

User asks to read, check, or manage emails - User asks to reply to or send an email - User asks to draft an email response

email-agent

242
from aiskillstore/marketplace

Processes incoming emails for Unite-Hub. Extracts sender data, identifies communication intents, links to CRM contacts, analyzes sentiment, and updates contact records with AI insights.

email-notify

242
from aiskillstore/marketplace

Send SMTP email notifications after Codex completes a task. Use when one Codex or Claude run is finished, or when you need to notify on task completion with device name, project name, status, and summary via email.

email-handler

242
from aiskillstore/marketplace

Create and send transactional emails using React Email. Covers templates, layout integration, and sending logic.

azure-quotas

242
from aiskillstore/marketplace

Check/manage Azure quotas and usage across providers. For deployment planning, capacity validation, region selection. WHEN: "check quotas", "service limits", "current usage", "request quota increase", "quota exceeded", "validate capacity", "regional availability", "provisioning limits", "vCPU limit", "how many vCPUs available in my subscription".

DevOps & Infrastructure