mcpField
S
send-email

send-email

github.com/wmy2981Productivity155 installsUpdated 5w ago
Repository

About send-email

send-email is a skill for sending email through SMTP from Claude Code. It supports plain text and HTML messages, attachments, and recipient lookup by contact name.

Key features

  1. 01Send email through SMTP
  2. 02Use plain text or HTML bodies
  3. 03Load HTML from a specified file
  4. 04Attach files to messages
  5. 05Resolve recipient addresses by contact name

Use cases

  1. 01Send a plain-text notice or message
  2. 02Send an HTML-formatted email
  3. 03Send an email with file attachments

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/wmy2981/skills --skill send-email

After installing, type/send-emailin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

.claude-plugin/
plugin.json
scripts/
.env.example
send.py

Details

From the project README

Send Email Skill

Send emails via SMTP from Claude Code. Supports plain text, HTML, attachments, and template-based workflow.

Execution Rule

Run the user's requested command directly without pre-checking dependencies, environment variables, or configuration. If something is wrong, the script will fail with a clear error — check and fix only then.

python scripts/send.py <to> <subject> <mode> <body> [attachment...]
Modes
ModePurposeExample Body
--textPlain text email"Just saying hi"
--htmlInline HTML string"<b>Alert</b>"
--fileHTML from file~/.wmyskills/send-email/msg/my.html

Long/complex HTML must use --file with a file inside ~/.wmyskills/send-email/msg/.

Examples

Plain text:

python scripts/send.py [email protected] "Hello" --text "Just saying hi"

Inline HTML (short):

python scripts/send.py [email protected] "Alert" --html "<b>Server is down</b>"

HTML from file (long/complex HTML):

python scripts/send.py [email protected] "Newsletter" --file ~/.wmyskills/send-email/msg/my_newsletter.html

With attachment (any mode):

python scripts/send.py [email protected] "Files" --text "See attached" report.pdf

Email Content Rules

Never add reply prompts in the email body. This skill is send-only and has no ability to receive or read emails. Do not include phrases like "reply to this email", "if you have any questions, feel free to reply", or any other wording that invites the recipient to respond by email — the response would go to an inbox nobody reads.

File Storage Rules

Violating these rules is a bug. Every email HTML file must go through the designated directories:

DirectoryPurpose
~/.wmyskills/send-email/templates/Read-only HTML templates. Copy from here, do not edit in place.
~/.wmyskills/send-email/msg/The ONLY directory for --file HTML files. Save here, then pass the path.

Rules:

  • All email HTML files must be saved in ~/.wmyskills/send-email/msg/ before sending with --file
  • Do NOT save HTML in the repo directory, /tmp, Downloads, Desktop, or any other location
  • Do NOT create a different directory structure — send.py discovers files relative to this path
  • The repo stores code, not runtime data. Runtime data goes in ~/.wmyskills/<skill-name>/

Contacts

Send to a named recipient instead of a full email address. The name-to-address mapping lives in a user-editable YAML file:

~/.wmyskills/send-email/contacts.yaml (~ = user home directory)

小明: [email protected]
张三: [email protected]

Lookup rule: when the recipient is a name (not a full address containing @), read this file and match the name exactly. Use the resolved email as the <to> argument. Never guess or invent an address.

SituationAction
Recipient contains @Use as-is, no lookup
Name not found in fileTell the user; list the available names from the file
File missingShow the structure above and let the user create it, or use the address the user provided
YAML parse errorAsk the user to check the file format

Security

Never read, display, or share the contents of scripts/.env or ~/.wmyskills/.env. They contain SMTP credentials. Use the table below only as a reference for which variables exist — do not read the actual .env files.

VariableDefaultDescription
EMAIL_HOST—SMTP server hostname
EMAIL_PORT465SMTP server port
EMAIL_USER—Sender email address
EMAIL_AUTH—SMTP password / app token
EMAIL_NAMEClaudeCodeSender display name

On Error

If sending fails:

Connection refused / timeout — EMAIL_HOST or EMAIL_PORT may be wrong; check with your provider.

Authentication failed — EMAIL_USER/EMAIL_AUTH may be wrong; some providers require an app-specific password.

smtplib exception — missing or incorrect env vars; SMTP exceptions are not caught and will print a traceback. Check EMAIL_HOST, EMAIL_USER, and EMAIL_AUTH are set correctly.

"file not found" / "attachment not found" — the path to the HTML file or attachment is invalid. Check the path and try again.

Notes

  • Escape sequences (\n, \t, etc.) in --text and --html body arguments are decoded automatically
  • No argparse is used — arguments are positional and order-sensitive
  • The EMAIL_PORT defaults to 465 (SSL); STARTTLS (587) is not supported
  • The --file mode path supports ~ for home directory expansion

Comments

Markdown supported