npx skills add https://github.com/wangyendt/wayne-skills --skill send-email使用 Python 通过 SMTP 发送邮件,支持纯文本、HTML 格式、文件附件和基于模板的邮件。
agent_skill_test@126.com此技能将逐步引导您完成邮件发送过程。
向用户询问以下必需信息。如果缺少任何信息,提示用户提供:
| 信息 | 描述 | 示例 |
|---|---|---|
收件人 (--to) | 要发送到的电子邮件地址 | user@example.com |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
主题 (--subject) | 邮件主题行 | Monthly Report |
内容 (--content) | 邮件正文文本或 HTML | Hello, here is your report. |
重要 - 默认发件人邮箱行为 :
如果用户在初始请求中未指定发件人邮箱,则自动使用agent_skill_test@126.com作为默认发件人。不要询问用户使用哪个邮箱发送。
仅当用户明确提及希望使用自己的邮箱地址时,才询问用户使用不同的发件人邮箱。
当使用默认的 agent_skill_test@126.com 时,直接进入步骤 2 并询问 126 邮箱授权码。
根据发件人邮箱地址的域名,识别邮件提供商并请求相应的凭据。
@gmail.com, @googlemail.com → Gmail
@outlook.com, @hotmail.com, @live.com, @office365.com → Outlook/Office 365
@qq.com, @vip.qq.com → QQ Mail
@163.com, @126.com → NetEase Mail
@aliyun.com, @aliyun-inc.com → Aliyun Mail
@sendgrid.net, @*.sendgrid.net → SendGrid
@*.mailgun.org → Mailgun
Other domains → Custom SMTP (ask for server, port, username, password)
Gmail (@gmail.com, @googlemail.com)
smtp.gmail.com587 (TLS) 或 465 (SSL)Outlook / Office 365 (@outlook.com, @hotmail.com, @live.com, @office365.com)
smtp.office365.com587 (TLS)QQ 邮箱 (@qq.com, @vip.qq.com)
smtp.qq.com587 (TLS) 或 465 (SSL)网易 163 邮箱 (@163.com)
smtp.163.com465 (SSL) 或 994 (IMAP)网易 126 邮箱 (@126.com)
smtp.126.com465 (SSL) 或 25 (SSL)SendGrid
smtp.sendgrid.net587 (TLS) 或 465 (SSL)apikey (字面意思就是这个字符串)Mailgun
smtp.mailgun.org587 (TLS)自定义 SMTP (其他域名) 请用户提供:
脚本通过查找常见模式自动检测邮件内容是否为 Markdown 格式:
#, ##, ###)**bold**, *italic*)- item 或 1. item)[text](url))如果检测到 Markdown,内容将自动转换为美观的 HTML 样式,包括:
您无需为 Markdown 内容手动指定--content-type html - 它会自动处理!
--from-name: 发件人的显示名称 (例如,"John Doe")--content-type html: 用于 HTML 格式的邮件 (默认为纯文本,但会自动转换 Markdown)--attach: 要附加的文件路径 (可指定多个)--template: 使用模板文件而不是内容--template-vars: 模板变量的 JSON 字符串发送前,与用户确认:
Ready to send:
From: [Sender Email]
To: [Recipient Email]
Subject: [Subject]
Content Type: [Plain/HTML]
Attachments: [List of attachments or None]
Proceed to send? (y/n)
如果确认,则使用所有收集的参数执行 send_email.py 脚本。
用户 : Send an email to john@example.com with subject "Hello"
技能 : I can help you send that email. I need a few more details:
用户 : The content is "Hi John, just saying hello!" and send from myemail@gmail.com
技能 : I detected you're using Gmail. For Gmail, you need an App Password (not your regular password).
To get your App Password:
Please provide your Gmail App Password:
用户 : abcd efgh ijkl mnop
技能 : Ready to send:
Proceed to send? (y/n)
用户 : 发一封邮件给 manager@company.com,主题是"AR眼镜行业分析",内容是 [用户提供的 Markdown 报告]
技能 : 我来帮您发送这封邮件。检测到您没有指定发件人邮箱,我将使用默认邮箱 agent_skill_test@126.com 发送。
同时,我发现您的内容是 Markdown 格式,将自动转换为美观的 HTML 格式,让报告更易读。
为了使用 126 邮箱发送,我需要您提供 SMTP 授权码 。
获取授权码步骤:
请提供agent_skill_test@126.com 的授权码:
用户 : [提供授权码]
技能 : 准备发送邮件:
确认发送? (y/n)
用户 : 发邮件给 user@company.com,主题是项目报告
技能 : 我需要收集邮件内容:
邮件正文是什么?
用户 : 项目已完成,所有里程碑都已达成。
技能 : 我将使用默认邮箱 agent_skill_test@126.com 发送。
为了使用 126 邮箱发送,我需要您提供 SMTP 授权码 。
获取授权码步骤:
请提供agent_skill_test@126.com 的授权码:
用户 : [提供授权码]
技能 : 准备发送邮件:
确认发送?(y/n)
用户 : Send a report to boss@company.com from myname@outlook.com about Q4 results, with attachment /home/user/q4_report.pdf
技能 : I'll help you send that email. Please provide the email content:
What should the email say about the Q4 results?
用户 : Please find attached the Q4 financial report. Let me know if you have any questions.
技能 : I see you're using Outlook. You'll need your Outlook account password (same as web login).
Please provide your Outlook password:
用户 : mypassword123
技能 : Ready to send:
Proceed to send? (y/n)
用户 : Send email to test@domain.com from my@domain.com
技能 : I need to gather some information:
用户 : Subject is Test Email, content is Hello World
技能 : Since you're using a custom domain (my@domain.com), I'll need your SMTP configuration:
用户 : Server is smtp.mydomain.com, port 587, username is my@domain.com, password is secret
技能 : Ready to send:
Proceed to send? (y/n)
收集所有信息后,使用适当的参数执行脚本:
python3 scripts/send_email.py \
--to recipient@example.com \
--subject "Email Subject" \
--content "Email body content" \
--smtp-server smtp.gmail.com \
--smtp-port 587 \
--username your@email.com \
--password your-password-or-app-password
python3 scripts/send_email.py \
--to recipient@example.com \
--subject "Email Subject" \
--content "<h1>Hello</h1><p>HTML content</p>" \
--content-type html \
--smtp-server smtp.gmail.com \
--smtp-port 587 \
--username your@email.com \
--password your-password
python3 scripts/send_email.py \
--to recipient@example.com \
--subject "Email Subject" \
--content "Email body" \
--attach /path/to/file1.pdf \
--attach /path/to/file2.csv \
--smtp-server smtp.gmail.com \
--smtp-port 587 \
--username your@email.com \
--password your-password
python3 scripts/send_email.py \
--to recipient@example.com \
--subject "Email Subject" \
--template assets/simple-notification.html \
--template-vars '{"title":"Notification","message":"Your report is ready!"}' \
--content-type html \
--smtp-server smtp.gmail.com \
--smtp-port 587 \
--username your@email.com \
--password your-password
python3 scripts/send_email.py \
--to recipient@example.com \
--subject "Email Subject" \
--content "Email body" \
--smtp-server smtp.gmail.com \
--smtp-port 465 \
--use-ssl \
--username your@email.com \
--password your-password
| 提供商 | SMTP 服务器 | 端口 | 加密 | 密码类型 | 用户名 |
|---|---|---|---|---|---|
| Gmail | smtp.gmail.com | 587 | TLS | 应用密码 | 完整邮箱地址 |
| Gmail | smtp.gmail.com | 465 | SSL | 应用密码 | 完整邮箱地址 |
| Outlook | smtp.office365.com | 587 | TLS | 账户密码 | 完整邮箱地址 |
| QQ 邮箱 | smtp.qq.com | 587 | TLS | 授权码 | 完整邮箱地址 |
| QQ 邮箱 | smtp.qq.com | 465 | SSL | 授权码 | 完整邮箱地址 |
| 163 邮箱 | smtp.163.com | 465 | SSL | 授权码 | 完整邮箱地址 |
| 163 邮箱 | smtp.163.com | 994 | SSL | 授权码 | 完整邮箱地址 |
| 126 邮箱 | smtp.126.com | 465 | SSL | 授权码 | 完整邮箱地址 |
| 126 邮箱 | smtp.126.com | 25 | SSL | 授权码 | 完整邮箱地址 |
| SendGrid | smtp.sendgrid.net | 587 | TLS | API 密钥 | apikey |
| SendGrid | smtp.sendgrid.net | 465 | SSL | API 密钥 | apikey |
| Mailgun | smtp.mailgun.org | 587 | TLS | SMTP 密码 | 来自仪表板 |
在使用此技能之前,请安装所需的 Python 依赖项:
pip install -r requirements.txt
这将安装 markdown 库 (版本 ≥3.4.0),这是自动 Markdown 转 HTML 转换所必需的。
用于发送邮件的主要 Python 脚本。支持:
常见的 SMTP 服务器配置,包括 Gmail、Outlook、126、QQ、163、SendGrid、Mailgun 和 Aliyun。
邮件模板:
simple-notification.html - 基本通知模板report-summary.html - 带有指标网格的专业报告模板每周安装数
171
仓库
GitHub 星标数
2
首次出现
2026年2月9日
安全审计
安装于
opencode160
codex156
gemini-cli155
cursor154
kimi-cli152
github-copilot152
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
152,900 周安装