- Home
- Skills
- Workflow Automation
- IMAP and SMTP Email Management
More screenshots
Works with the AI Agents you already use
IMAP and SMTP Email Management
Wire up programmatic email correctly the first time: provider app passwords instead of login passwords, UID-based reading, tested sends, and the domain-auth checks that keep mail out of spam.
$5
IMAP and SMTP Email Management
Example session with this skill installed
I want to watch a Gmail inbox for invoices, save the attachments, and email myself a daily summary of anything else that needs a reply. Every tutorial I follow dies at "auth failed" — get me a working setup.
- Read your context and instructions
- Compiled the imap and smtp
SETUP — produced by applying the skill's workflow in order.
Step 1, credentials. Your login password is the bug: Gmail rejects it for programmatic access, always. Enable 2-Step Verification on the mailbox, generate a 16-character App Password, and store it as MAIL_SECRET in a gitignored .env — never in the script. If you'd tried an authorization-code provider (163/QQ) the equivalent step is enabling IMAP in web settings first, then generating the code.
Step 2, connect and prove it. IMAP host imap.gmail.com, port 993 (TLS on connect); SMTP smtp.gmail.com, port 587 (STARTTLS). Run the test ladder in order and stop at the first red rung: TCP connect → TLS handshake with verification on → authenticate → select inbox read-only and read the count → one test message to yourself, confirmed in the inbox. Each rung isolates one failure class, so a failure names its own fix.
Step 3, the watcher job. Poll every 10 minutes — minutes, not seconds; aggressive polling gets throttled. Invoice pass: server-side search FROM your billing sender, UNSEEN only. Fetch matches by UID (stable across sessions; sequence numbers shift when mail is deleted), save PDFs to the invoices folder with filenames sanitized — attachment names are sender-controlled, and a name like ../../invoice.pdf is a path-traversal attempt until proven otherwise. Record each processed UID in a state file and set the Seen flag deliberately, so a restart reprocesses nothing.
Step 4, the digest. Second search: UNSEEN excluding the billing sender. Fetch headers only, group by sender, compose one plain-text digest (subjects + senders), send it to you once a day instead of a notification per message. Before this first real send, the scorecard: credentials 2/2 (app password), domain auth — Gmail's domain carries SPF/DKIM/DMARC for its own sending, 2/2, test send verified in inbox 2/2, send pattern 2/2 (one digest, bounces to a real mailbox). 8/8, no zeros — cleared to run.
Connects securely to your tools. The creator never sees your data.
About this skill
Almost every email automation project dies at the same place: "auth failed." The tutorials say to use your mailbox password, and modern providers reject it — Gmail wants an App Password, Outlook may want OAuth, the Chinese providers want an authorization code you generate after enabling IMAP in web settings. This skill starts there, with the per-provider credential table, so the connection works before any job logic gets written. From there it gives you the standard connection matrix (IMAP 993, SMTP 587/465, per-provider hosts), a five-rung test ladder that isolates exactly which layer is broken when something fails, and the reading model that keeps jobs reliable: server-side search before fetching, everything addressed by stable UID instead of sequence numbers, headers first and bodies on demand, attachment filenames treated as untrusted. Sending gets the same discipline: test message to yourself before any batch, Bcc hygiene, size caps, and the deliverability scorecard — SPF, DKIM, DMARC, warm-up, bounce handling — scored before the first real send so your mail lands in inboxes instead of spam folders. Three automation patterns are spelled out (inbox watcher, alert sender, digest builder), a worked example runs a support-inbox watcher end to end including a path-traversal attachment name it had to sanitize, and the edge cases cover the failures that actually happen in production: revoked app passwords, UIDVALIDITY changes after a mailbox migration, legacy-charset headers, and polling yourself into a throttle ban.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Workflow Automation.
- Some organizations disable IMAP entirely or require admin-consented OAuth; when that's the policy, the sanctioned path is the provider's proprietary API, which this skill doesn't cover.
- Provider settings screens and policies change; the credential routes described are the current standard ones, but a provider can rename or move them.
- Deliverability also depends on your domain's history and your recipients; the scorecard covers what you control, not a sender reputation you inherited.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 24 days ago
Permissions
No special permissions declared or detected