360 Secure SkillHub
360 安全技能中心

Aliyun Mail

这是一款依托阿里云企业邮箱的邮件发送工具,核心功能包括支持纯文本、Markdown(含代码高亮)、HTML格式邮件,可添加多附件,通过配置文件管理SMTP凭证,具备重试机制与详细错误提示。典型场景如发送代码报告、周报等,支持从文件读取内容,通过命令行参数完成操作,需先配置SMTP信息文件。

jixsonwang
jixsonwang
热度 82.45
最近更新 2026-05-11 15:54:52
分类:协作依赖:代码执行 / 读写文件 / 第三方 API应用场景:邮件起草

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add aliyun-mail
Metadata
name
aliyun-mail
description
A skill to send emails via Aliyun enterprise email service with support for markdown, HTML text, attachments, and syntax highlighting for code blocks.

Aliyun Mail Skill

This skill enables sending emails through Aliyun enterprise email service with advanced features including Markdown conversion, HTML styling, file attachments, and syntax highlighting for code blocks.

Features

  • Aliyun Enterprise Email Support: Optimized for Aliyun's SMTP service (smtp.mxhichina.com)
  • Multiple Content Types: Send plain text, Markdown, or HTML emails
  • Markdown with Syntax Highlighting: Automatic syntax highlighting for code blocks in Markdown
  • File Attachments: Include one or more files as attachments
  • Configuration-based: Uses a secure configuration file for SMTP credentials
  • Error Handling: Includes retry logic and detailed error reporting

Prerequisites

  • SMTP Configuration File: Create aliyun-mail-config.json in your OpenClaw config directory (/root/.openclaw/)

Example configuration file:

{
  "server": "smtp.mxhichina.com",
  "port": 465,
  "username": "your-email@yourdomain.com",
  "password": "your-app-password",
  "emailFrom": "your-email@yourdomain.com",
  "useTLS": true
}

Ensure the configuration file has secure permissions:

chmod 600 /root/.openclaw/aliyun-mail-config.json

Usage

Basic Text Email

aliyun-mail send --to "recipient@example.com" --subject "Hello" --body "This is a plain text email"

Markdown Email with Syntax Highlighting

aliyun-mail send \
  --to "recipient@example.com" \
  --subject "Code Report" \
  --body "**Check out this Python code:**\n\n```python\nprint('Hello World')\n```" \
  --markdown

HTML Email with Attachment

aliyun-mail send \
  --to "recipient@example.com" \
  --subject "Weekly Report" \
  --body "<h1>Weekly Report</h1><p>See attached file.</p>" \
  --html \
  --attachments "/path/to/report.pdf"

Using Body from File

aliyun-mail send \
  --to "recipient@example.com" \
  --subject "Report from File" \
  --body-file "/path/to/report.md" \
  --markdown \
  --attachments "/path/to/data.csv"

Command Line Options

  • --to: Recipient email address (required)
  • --subject: Email subject (required)
  • --body: Email body content (required if --body-file not provided)
  • --body-file: Path to file containing email body
  • --html: Send as HTML email (default: plain text)
  • --markdown: Send as Markdown email with syntax highlighting
  • --attachments: Space-separated list of file paths to attach

Error Handling

The tool includes robust error handling with up to 3 retry attempts on failure. Network issues, authentication errors, and invalid email addresses are reported with detailed error messages.

Security Notes

  • Always use app-specific passwords rather than your main email password
  • Keep the configuration file secure with proper file permissions
  • Never commit configuration files to version control

Future Enhancements

  • Support for CC/BCC recipients
  • Email templates system
  • Scheduled email sending
  • Rich text editor integration