SDK
所有 SDK 都直接连接您的 Runtime,并使用 ALL2CF_SEND_URL 与 ALL2CF_SEND_KEY。@all2cf/send 已在 npm 正式公开,并通过 npm 与 pnpm 全新安装验证;两个包管理器使用同一个 npm Registry 包。
npm install @all2cf/send# 或pnpm add @all2cf/sendimport { CFsend } from "@all2cf/send";
const send = new CFsend(process.env.ALL2CF_SEND_KEY, { baseUrl: process.env.ALL2CF_SEND_URL,});
await send.emails.send({ from: "hello@example.com", to: ["alex@example.net"], subject: "Hello", html: "<p>Hello from CFsend</p>",});返回值为 { data, error },不要忽略 error。客户端支持 emails 的发送、列表、详情、取消、改期、重试和附件,也支持 batch、templates、webhooks、API keys、domains、logs、suppressions、topics 和订阅偏好。
Python、PHP、Go、Java、.NET、Ruby、Rust 源码包使用相同公开 REST 契约。只有对应 registry 已出现正式包并完成干净安装发送验收后才算 Available;此前统一为源码预览。不要使用 Business Mail 包或共享 All2CF 地址。