gmail +send
PREREQUISITE: Read ../gws-shared/SKILL.md for auth, global flags, and security rules. If missing, run gws generate-skills to create it.
Send an email
Usage
CODEBLOCK0
Flags
| Flag | Required | Default | Description |
|---|
| INLINECODE2 | ✓ | — | Recipient email address(es), comma-separated |
| INLINECODE3 |
✓ | — | Email subject |
|
--body | ✓ | — | Email body (plain text, or HTML with --html) |
|
--from | — | — | Sender address (for send-as/alias; omit to use account default) |
|
--attach | — | — | Attach a file (can be specified multiple times) |
|
--cc | — | — | CC email address(es), comma-separated |
|
--bcc | — | — | BCC email address(es), comma-separated |
|
--html | — | — | Treat --body as HTML content (default is plain text) |
|
--dry-run | — | — | Show the request that would be sent without executing it |
|
--draft | — | — | Save as draft instead of sending |
Examples
CODEBLOCK1
Tips
- - Handles RFC 5322 formatting, MIME encoding, and base64 automatically.
- Use --from to send from a configured send-as alias instead of your primary address.
- Use -a/--attach to add file attachments. Can be specified multiple times. Total size limit: 25MB.
- With --html, use fragment tags (
, , ,
, etc.) — no / wrapper needed.
- Use --draft to save the message as a draft instead of sending it immediately.
[!CAUTION]
This is a write command — confirm with the user before executing.
See Also
技能名称: gws-gmail-send
详细描述:
gmail +send
前置条件: 阅读 ../gws-shared/SKILL.md 了解认证、全局标志和安全规则。如果该文件缺失,请运行 gws generate-skills 创建。
发送一封电子邮件
用法
bash
gws gmail +send --to <电子邮件地址> --subject <主题> --body <正文>
标志
| 标志 | 必需 | 默认值 | 描述 |
|---|
| --to | ✓ | — | 收件人电子邮件地址,多个地址用逗号分隔 |
| --subject |
✓ | — | 邮件主题 |
| --body | ✓ | — | 邮件正文(纯文本,或使用 --html 时为 HTML) |
| --from | — | — | 发件人地址(用于发送别名;省略则使用账户默认地址) |
| --attach | — | — | 附加文件(可多次指定) |
| --cc | — | — | 抄送电子邮件地址,多个地址用逗号分隔 |
| --bcc | — | — | 密送电子邮件地址,多个地址用逗号分隔 |
| --html | — | — | 将 --body 视为 HTML 内容(默认为纯文本) |
| --dry-run | — | — | 显示将要发送的请求而不实际执行 |
| --draft | — | — | 保存为草稿而非发送 |
示例
bash
gws gmail +send --to alice@example.com --subject 你好 --body 嗨,爱丽丝!
gws gmail +send --to alice@example.com --subject 你好 --body 嗨! --cc bob@example.com
gws gmail +send --to alice@example.com --subject 你好 --body 加粗 文本 --html
gws gmail +send --to alice@example.com --subject 你好 --body 嗨! --from alias@example.com
gws gmail +send --to alice@example.com --subject 报告 --body 见附件 -a report.pdf
gws gmail +send --to alice@example.com --subject 文件 --body 两个文件 -a a.pdf -a b.csv
gws gmail +send --to alice@example.com --subject 你好 --body 嗨! --draft
提示
- - 自动处理 RFC 5322 格式、MIME 编码和 base64。
- 使用 --from 从已配置的发送别名发送,而非主地址。
- 使用 -a/--attach 添加文件附件。可多次指定。总大小限制:25MB。
- 使用 --html 时,使用片段标签(
、、、
等)——无需 / 包装。
- 使用 --draft 将消息保存为草稿,而非立即发送。
[!注意]
这是一个写入命令——执行前请与用户确认。
另请参阅