home / skills / aidotnet / moyucode / email-sender

email-sender skill

/skills/tools/email-sender

This skill sends emails via SMTP with HTML content, attachments, and multiple recipients, leveraging nodemailer for reliable notifications.

npx playbooks add skill aidotnet/moyucode --skill email-sender

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.1 KB
---
name: email-sender
description: 使用SMTP发送带附件的邮件,支持HTML模板、多收件人和文件附件。基于nodemailer。
metadata:
  short-description: 通过SMTP发送邮件
source:
  repository: https://github.com/nodemailer/nodemailer
  license: MIT
---

# Email Sender Tool

## Description
Send emails with HTML content, attachments, and multiple recipients via SMTP.

## Trigger
- `/send-email` command
- User requests to send email
- User needs email notification

## Usage

```bash
# Send simple email
python scripts/send_email.py --to "[email protected]" --subject "Hello" --body "Message content"

# Send with attachment
python scripts/send_email.py --to "[email protected]" --subject "Report" --body "See attached" --attachment "report.pdf"

# Send HTML email
python scripts/send_email.py --to "[email protected]" --subject "Newsletter" --html "template.html"
```

## Environment Variables

```env
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
[email protected]
SMTP_PASS=your-app-password
SMTP_FROM=Your Name <[email protected]>
```

## Tags
`email`, `smtp`, `notification`, `automation`

## Compatibility
- Codex: ✅
- Claude Code: ✅

Overview

This skill sends emails over SMTP using nodemailer, supporting HTML templates, multiple recipients, and file attachments. It is implemented in TypeScript and configured via environment variables for SMTP host, port, user, and password. The tool is designed for reliable programmatic email delivery from servers or automation scripts.

How this skill works

The skill constructs MIME-compliant messages with optional HTML body, plain-text fallback, and attached files, then hands them to nodemailer which speaks SMTP to the configured mail server. Recipients can be a single address, comma-separated list, or arrays for To/Cc/Bcc. Credentials and sender identity are provided via environment variables to keep secrets out of code.

When to use it

  • Send automated notifications from a backend service or cron job
  • Deliver reports or logs as file attachments to multiple stakeholders
  • Distribute HTML newsletters or templated messages programmatically
  • Trigger transactional emails from webhooks, forms, or CI pipelines
  • Replace manual email sending in batch workflows or scripts

Best practices

  • Use environment variables for SMTP credentials and sender address to avoid hardcoding secrets
  • Provide both HTML and plain-text bodies to maximize deliverability and accessibility
  • Limit attachment sizes and validate file types before sending
  • Use To/Cc/Bcc appropriately and respect recipient privacy with Bcc for large lists
  • Monitor SMTP response and implement retry logic for transient errors

Example use cases

  • Send a daily PDF report to a team distribution list with the report attached
  • Deliver password reset or account verification emails from a web app
  • Distribute build artifacts or logs after CI completion to developers
  • Send a templated newsletter with inline images and a plain-text fallback
  • Notify on-call engineers via email when monitoring alerts trigger

FAQ

How do I configure SMTP credentials?

Set SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, and SMTP_FROM as environment variables before running the process.

Can I send to multiple recipients and include attachments?

Yes. The skill accepts multiple recipients (comma-separated or arrays) and supports file attachments and inline assets via the message options.