360 Secure SkillHub
360 安全技能中心

smtp-sender

一个 Python 命令行脚本,读取本地 SMTP 配置文件(服务器、端口、账号、密码、发件人、TLS 开关)后发送邮件;正文可用 Markdown 转 HTML,也可附带一个或多个附件。失败时最多重试 3 次并记录发送日志与错误信息,便于排查网络或凭据问题。

xlbbb-cn
xlbbb-cn
热度 88.02
最近更新 2026-05-17 12:59:14
分类:协作依赖:代码执行 / 读写文件 / 第三方 API应用场景:邮件起草 / 自动化脚本 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add smtp-sender
Metadata
name
smtp-sender
description
A skill to send emails with support for markdown, HTML text, and attachments, leveraging existing SMTP configuration in `{skill~}/smtp-config.json`. Includes retry logic and logging.

Custom SMTP Sender

Custom skill to send emails with advanced options including HTML/Markdown conversion, attachments, and retry handling. Integrates existing configuration, ensuring secure and reliable operations.

Features

  • HTML/Markdown support: Compose emails using markdown converted to HTML.
  • Attachments: Include one or more files easily.
  • Retries: Attempts to resend in case of temporary failures.
  • Logging: Maintains a log of sent emails and errors for auditing.

Prerequisites

  • SMTP Configuration File: smtp-config.json located at ~skill/smtp-config.json

Example:

{
  "server": "smtp.exmail.qq.com",
  "port": 465,
  "username": "your-email@example.com",
  "password": "your-password",
  "emailFrom": "your-email@example.com",
  "useTLS": true
}

Ensure file permissions are secured (chmod 600).

Usage

Send a basic email:

python3 ~/.openclaw/workspace/skills/smtp-sender/email_sender.py --to "recipient@example.com" --subject "Hello" --body "你好"

Send an HTML email with an attachment:

python3 ~/.openclaw/workspace/skills/smtp-sender/email_sender.py \
  --to "recipient@example.com" \
  --subject "Weekly Report" \
  --body "**Important updates inside.** See attached." \
  --html \
  --attachments path/to/file.pdf

Error Handling

The tool retries up to 3 times on failure, logging each attempt. Networking or credential issues are reported in detail.

Future Expansion

  • Support for CC/BCC fields
  • Scheduling emails (cron integration)
  • Email templates

Set up your SMTP-service once, and you’re ready to integrate email into your workflow!