UniOne邮件发送

4小时前更新 1 00
UniOne邮件发送UniOne邮件发送
UniOne邮件发送

技能简介

UniOne是面向开发者的邮件发送服务,支持每秒3000封邮件的高并发投递。该技能通过Web API实现事务邮件营销邮件的发送、模板管理、地址验证、投递追踪等功能。

能做什么

  • 发送事务邮件与营销邮件
  • 管理邮件模板
  • 验证邮箱地址格式
  • 查询投递统计数据
  • 管理退信列表
  • 配置Webhook回调
  • 设置发件域名

使用说明

环境准备

# 设置API密钥
export UNIONE_API_KEY="your_api_key_here"

关键前提:域名验证(必须完成)

邮件在域名验证通过前无法送达。按以下步骤操作:

  1. 获取DNS记录值
    curl -X POST "https://api.unione.io/en/transactional/api/v1/domain/get-dns-records.json?platform=openclaw" \
      -H "Content-Type: application/json" \
      -H "X-API-KEY: $UNIONE_API_KEY" \
      -d '{"domain": "yourdomain.com"}'
  2. 在DNS服务商处添加3条TXT记录:
    • @ TXT unione-validate-hash=<接口返回的verification-record>
    • us._domainkey TXT k=rsa; p=<接口返回的dkim>
    • @ TXT v=spf1 include:spf.unione.io ~all
  3. 验证域名所有权
    curl -X POST "https://api.unione.io/en/transactional/api/v1/domain/validate-verification.json?platform=openclaw" \
      -H "Content-Type: application/json" \
      -H "X-API-KEY: $UNIONE_API_KEY" \
      -d '{"domain": "yourdomain.com"}'
  4. 验证DKIM配置
    curl -X POST "https://api.unione.io/en/transactional/api/v1/domain/validate-dkim.json?platform=openclaw" \
      -H "Content-Type: application/json" \
      -H "X-API-KEY: $UNIONE_API_KEY" \
      -d '{"domain": "yourdomain.com"}'

DNS生效可能需要48小时,验证失败请检查记录拼写或稍后重试。

发送邮件示例

curl -X POST "https://api.unione.io/en/transactional/api/v1/email/send.json?platform=openclaw" \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: $UNIONE_API_KEY" \
  -d '{
    "message": {
      "recipients": [{"email": "user@example.com"}],
      "body": {"html": "<p>Hello World</p>"},
      "subject": "Test Email",
      "from_email": "noreply@yourdomain.com"
    },
    "idempotency_key": "uuid-for-this-send"
  }'

重试策略

遇到429/500/502/503/504错误时,按以下间隔重试:立即、1秒、5秒、30秒。每次发送务必携带唯一的idempotency_key,重试时使用相同key避免重复投递。

输入与输出

见下方输入与输出表格。

项目内容
输入收件人邮箱地址、邮件主题、HTML/纯文本内容、发件域名、idempotency_key(幂等键)
输出发送状态、message_id、投递统计、错误代码
适用人群需要批量发送事务邮件的系统、营销活动邮件推送、邮件投递状态监控场景
不包含SMTP协议接入、邮件客户端UI、联系人列表管理界面、A/B测试功能

 

风险提示

  • 未验证域名的邮件将被丢弃,不会进入投递队列
  • 缺少idempotency_key可能导致网络异常时重复发送
  • API密钥泄露将导致账户被盗用发送垃圾邮件
  • 高频请求可能触发速率限制,需实现退避逻辑
  • 邮件内容违规可能导致账户被封禁

来源信息

原始链接:https://github.com/openclaw/skills/tree/main/skills/andythemartketing/unione/SKILL.md
来源类型:GitHub仓库

数据统计

相关导航

暂无评论

none
暂无评论...