Email

From aiskillstore/marketplace · View interactive version

Email is an AI agent skill from the GitHub repository aiskillstore/marketplace. 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.

How to use this skill

Skill file

Email Operations Skill

Overview

This skill provides email capabilities through direct IMAP/SMTP protocol access using curl. It supports:

Architecture

Available Scripts

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

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

Usage:

./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:

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

Retrieve email headers from a mailbox.

Usage:

./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:

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

Read full content of a specific email by ID.

Usage:

./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:

Configuration

Account Setup

Edit references/accounts.yaml to add email accounts:

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:

# 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:

Common Use Cases

1. Send a Quick Email

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

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?"

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).

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"

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

4. Email Automation

Combine with other skills for automation:

Error Handling

Common Issues

  1. Authentication Failed
  1. Connection Timeout
  1. TLS Handshake Failed

Security Considerations

Provider-Specific Notes

Tencent Enterprise Mail (exmail.qq.com)

Gmail

Outlook/Office 365

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:

IMAP vs POP3

This skill uses IMAP (not POP3) because:

Future Enhancements

Potential improvements (not yet implemented):

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.