Migma
Create and send professional, on-brand emails with AI. Your agent can design emails from a prompt, send them instantly through a managed domain, and manage an entire audience — all from the terminal.
Always pass --json for structured output.
First-time setup
If the user hasn't set up yet, run these steps once:
CODEBLOCK0
Create an email
When the user asks to create, design, or generate an email:
CODEBLOCK1
The --wait flag blocks until the AI finishes. The JSON response includes conversationId, subject, and html.
To save the HTML locally, add --save ./email.html. To include a reference image (screenshot, design mockup), add --image <url>.
Send an email
When the user asks to send an email to someone:
CODEBLOCK2
INLINECODE7 auto-exports the HTML from a generated email — no separate export step.
Validate an email
When the user wants to check an email before sending:
CODEBLOCK3
Returns an overall score plus individual checks: compatibility (30+ email clients), broken links, spelling/grammar, and deliverability/spam score. Individual checks: migma validate compatibility, links, spelling, deliverability.
Export to platforms
When the user wants to export to an ESP or download a file:
CODEBLOCK4
Manage contacts
CODEBLOCK5
Manage tags and segments
CODEBLOCK6
Import a brand
When the user wants to set up a new brand from their website:
CODEBLOCK7
This fetches logos, colors, fonts, and brand voice automatically.
Error handling
On error, --json returns:
CODEBLOCK8
Migma
使用AI创建并发送专业、符合品牌形象的邮件。您的智能体可以根据提示设计邮件,通过托管域名即时发送,并管理整个受众群体——全部在终端中完成。
始终传递 --json 参数以获取结构化输出。
首次设置
如果用户尚未完成设置,请按以下步骤操作一次:
bash
1. 创建即时发送域名(无需DNS配置)
migma domains managed create <公司名称> --json
→ 发送地址:hello@<公司名称>.migma.email
2. 设置默认项目(品牌)
migma projects list --json
migma projects use <项目ID>
创建邮件
当用户要求创建、设计或生成邮件时:
bash
migma generate 新订阅者欢迎邮件 --wait --json
--wait 参数会阻塞直到AI完成。JSON响应包含 conversationId、subject 和 html。
如需将HTML保存到本地,添加 --save ./email.html。如需包含参考图片(截图、设计稿),添加 --image 。
发送邮件
当用户要求向某人发送邮件时:
bash
直接发送已生成的邮件
migma send --to sarah@example.com --subject 欢迎! \
--from-conversation <对话ID> \
--from hello@company.migma.email --from-name 公司名称 --json
或从本地HTML文件发送
migma send --to sarah@example.com --subject 你好 \
--html ./email.html \
--from hello@company.migma.email --from-name 公司名称 --json
发送给整个分组或标签
migma send --segment
--subject 重大消息 --html ./email.html \
--from hello@company.migma.email --from-name 公司名称 --json
使用模板变量进行个性化
migma send --to user@example.com --subject 你好{{name}} --html ./email.html \
--from hello@company.migma.email --from-name 公司名称 \
--var name=Sarah --var discount=20 --json
--from-conversation 会自动从生成的邮件中导出HTML——无需单独的导出步骤。
验证邮件
当用户想在发送前检查邮件时:
bash
migma validate all --html ./email.html --json
migma validate all --conversation <对话ID> --json
返回总体评分及各项检查:兼容性(30+邮件客户端)、失效链接、拼写/语法、可送达性/垃圾邮件评分。单项检查:migma validate compatibility、links、spelling、deliverability。
导出到平台
当用户想导出到ESP或下载文件时:
bash
migma export html <对话ID> --output ./email.html
migma export klaviyo <对话ID> --json
migma export mailchimp <对话ID> --json
migma export hubspot <对话ID> --json
migma export pdf <对话ID> --json
migma export mjml <对话ID> --json
管理联系人
bash
migma contacts add --email user@example.com --firstName John --json
migma contacts list --json
migma contacts import ./contacts.csv --json
migma contacts remove --json
管理标签和分组
bash
migma tags create --name VIP --json
migma tags list --json
migma segments create --name 活跃用户 --description ... --json
migma segments list --json
导入品牌
当用户想从网站设置新品牌时:
bash
migma projects import https://yourbrand.com --wait --json
migma projects use <项目ID>
这将自动获取Logo、颜色、字体和品牌语调。
错误处理
出错时,--json 返回:
json
{error: {message: 未找到, code: not_found, statusCode: 404}}