Resend Email Skill
Send emails programmatically using the Resend API via a Python script.
Default Recipient: ltononro@gmail.com (if --to is not provided)
From: CodeWorks Agent <lucas.tonon@dbx0.lol>
Prerequisites
- •
Resend API Key - Must be set in
.envfile at project root:codeRESEND_API_KEY=re_xxxxxxxxxx
- •
Python dependencies - Install resend and python-dotenv:
bashpip install resend python-dotenv
Usage
bash
python scripts/send-email.py --subject="Email Subject" --body="Email body content"
With a custom recipient:
bash
python scripts/send-email.py --to="user@example.com" --subject="Email Subject" --body="Email body content"
Or with HTML content:
bash
python scripts/send-email.py --subject="Email Subject" --html="<h1>HTML content</h1>"
Arguments
| Argument | Required | Description |
|---|---|---|
--to | No | Recipient email address (default: ltononro@gmail.com) |
--subject | Yes | Email subject line |
--body | No* | Plain text email body (converted to HTML) |
--html | No* | HTML email body for rich formatting |
*Must provide either --body or --html
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Email sent successfully |
| 1 | Error (missing API key, API error) |
Examples
bash
# Simple text email (to default recipient) python scripts/send-email.py --subject="Hello" --body="This is a test email." # Email to custom recipient python scripts/send-email.py --to="user@example.com" --subject="Hello" --body="This is a test email." # HTML newsletter python scripts/send-email.py --subject="Weekly Update" --html="<h1>This Week</h1><ul><li>Item 1</li><li>Item 2</li></ul>" # Multi-line body python scripts/send-email.py --subject="Report" --body="Line 1 Line 2 Line 3"
Notes
- •Default recipient is
ltononro@gmail.com(used when--tois not provided) - •From address is
CodeWorks Agent <lucas.tonon@dbx0.lol> - •Plain text body is automatically converted to HTML with line breaks
- •API response includes the email ID for tracking
Troubleshooting
| Issue | Solution |
|---|---|
RESEND_API_KEY not found | Create .env file with your API key |
Invalid API key | Verify key in Resend dashboard |
Must provide either --body or --html | Add content argument |