AgentSkillsCN

resend-email

使用 Resend API 以专业化的 HTML 模板和文件附件,实现程序化发送邮件。支持自定义收件人,并在无指定收件人时自动回退至 ltononro@gmail.com。触发条件:用户请求通过 Resend 发送邮件、执行程序化邮件发送、使用 Resend API,或附带附件/文件发送邮件。该技能会调用一个 Python 脚本,传入主题、正文、可选收件人以及文件附件参数。

SKILL.md
--- frontmatter
description: Send emails programmatically using the Resend API with a professional HTML template and file attachments. Supports custom recipients
  with fallback to ltononro@gmail.com. TRIGGERS - User asks to send email via Resend,
  send programmatic email, use Resend API, or send email with attachments/files. Executes a Python script with subject,
  body, optional recipient, and file attachment arguments.
name: resend-email

Resend Email Skill

Send emails programmatically using the Resend API via a Python script with a professional HTML template and file attachment support.

Default Recipient: ltononro@gmail.com (if --to is not provided) From: CodeWorks Agent <lucas.tonon@dbx0.lol>

Features

  • Professional HTML Template - All emails are wrapped in a clean, responsive template with:
    • Gradient header with CodeWorks Agent branding
    • Clean white content area with proper typography
    • Footer with copyright and attribution
    • Mobile-responsive design
    • Outlook/MS Office compatibility
  • Template can be disabled - Use --no-template to send raw content
  • File Attachments - Attach any files (PDFs, images, documents, etc.) using --attachments

Prerequisites

  1. Resend API Key - The API key is stored in .claude/skills/resend-email/.env:

    code
    RESEND_API_KEY=re_JWHGALZV_LsD4NMGfdjQVNJrZQb8b2PnU
    

    This file is bundled with the skill and will be copied when the skill is attached to an agent.

  2. Python dependencies - Install resend and python-dotenv:

    bash
    pip install resend python-dotenv
    

Usage

Run from the agent's repository root:

bash
python .claude/skills/resend-email/scripts/send-email.py --subject="Email Subject" --body="Email body content"

With a custom recipient:

bash
python .claude/skills/resend-email/scripts/send-email.py --to="user@example.com" --subject="Email Subject" --body="Email body content"

With HTML content:

bash
python .claude/skills/resend-email/scripts/send-email.py --subject="Email Subject" --html="<h1>HTML content</h1>"

Without the template (raw content):

bash
python .claude/skills/resend-email/scripts/send-email.py --subject="Email Subject" --body="Plain content" --no-template

With file attachments:

bash
python .claude/skills/resend-email/scripts/send-email.py --subject="Report" --body="Please find attached." --attachments="/path/to/report.pdf"

With multiple attachments:

bash
python .claude/skills/resend-email/scripts/send-email.py --subject="Files" --body="Here are the files." --attachments="/path/to/file1.pdf,/path/to/image.png,/path/to/doc.docx"

Arguments

ArgumentRequiredDescription
--toNoRecipient email address (default: ltononro@gmail.com)
--subjectYesEmail subject line
--bodyNo*Plain text email body (converted to HTML)
--htmlNo*HTML email body for rich formatting
--no-templateNoSkip the HTML template wrapper and send raw content
--attachmentsNoComma-separated list of file paths to attach

*Must provide either --body or --html

Exit Codes

CodeMeaning
0Email sent successfully
1Error (missing API key, API error)

Examples

bash
# Simple text email with template (to default recipient)
python .claude/skills/resend-email/scripts/send-email.py --subject="Hello" --body="This is a test email."

# Email to custom recipient
python .claude/skills/resend-email/scripts/send-email.py --to="user@example.com" --subject="Hello" --body="This is a test email."

# HTML newsletter with template
python .claude/skills/resend-email/scripts/send-email.py --subject="Weekly Update" --html="<h1>This Week</h1><ul><li>Item 1</li><li>Item 2</li></ul>"

# Raw HTML without template
python .claude/skills/resend-email/scripts/send-email.py --subject="Custom Email" --html="<html><body>Custom HTML</body></html>" --no-template

# Multi-line body
python .claude/skills/resend-email/scripts/send-email.py --subject="Report" --body="Line 1
Line 2
Line 3"

# Email with single attachment
python .claude/skills/resend-email/scripts/send-email.py --subject="Invoice" --body="Please find your invoice attached." --attachments="/tmp/invoice.pdf"

# Email with multiple attachments
python .claude/skills/resend-email/scripts/send-email.py --subject="Project Files" --body="Here are the requested files." --attachments="/tmp/report.pdf,/tmp/chart.png,/tmp/data.xlsx"

# Email with attachment to custom recipient
python .claude/skills/resend-email/scripts/send-email.py --to="client@example.com" --subject="Contract" --body="Please review the attached contract." --attachments="/tmp/contract.pdf"

Template Styling

The HTML template supports the following content elements with built-in styling:

  • Headings (h1, h2, h3, h4) - Dark text with proper sizing
  • Paragraphs - Gray text with comfortable line height
  • Links - Indigo color (#6366f1) with hover underline
  • Lists (ul, ol) - Properly spaced items
  • Code blocks - Light background with monospace font
  • Blockquotes - Indigo left border with light background

Notes

  • Default recipient is ltononro@gmail.com (used when --to is not provided)
  • From address is CodeWorks Agent <lucas.tonon@dbx0.lol>
  • Plain text body is automatically converted to HTML with line breaks
  • By default, all emails use the professional HTML template
  • Use --no-template to send raw content without the wrapper
  • API response includes the email ID for tracking
  • The .env file with the API key is located at .claude/skills/resend-email/.env
  • Attachments are read from disk and base64 encoded before sending
  • Multiple attachments can be specified as a comma-separated list
  • Invalid attachment paths are skipped with a warning (email still sends)

Troubleshooting

IssueSolution
RESEND_API_KEY not foundEnsure .claude/skills/resend-email/.env file exists with API key
Invalid API keyVerify key in Resend dashboard
Must provide either --body or --htmlAdd content argument
Attachment file not foundVerify the file path exists and is accessible
No valid attachments foundCheck that all provided file paths are correct