# send()

Canonical URL: https://developers.iagenify.com/zh/sdk/ref/mailbox/send/
Language: zh

`mailbox.send({ to, cc?, bcc?, subject, text?, html?, attachments?, replyTo?, signature? }) → Promise<Sent>`

从这个地址发送, 签名时使用域名的密钥。 答案表示收件人会看到哪个地址 。

Status: POST · the signature is added · accepted is not delivered

```javascript
const sent = await box.send({
  to: ["someone@example.net"],
  bcc: ["accounting@example.com"],
  subject: "Your invoice",
  html: '<h1>Thank you</h1><img src="cid:logo">',
  text: "Thank you",                       // plain-text fallback
  attachments: [
    { filename: "invoice.pdf", content: pdfBytes, contentType: "application/pdf" },
    { filename: "logo.png", content: logoBytes, cid: "logo" },   // shown inside the HTML
    { filename: "quote.pdf", path: "./quote.pdf" },              // Node only
  ],
});

// { id, relay: { name, from, aligned, warning }, credits,
//   attachments: [{ filename, size, contentType, inline }] }
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `to` | string | string[] | 必填 | 接收者。 |
| `cc` | string | string[] |  | 复制件。 |
| `subject` | string |  | 主题 |
| `text` | string |  | 纯文字。 |
| `html` | string |  | 或 HTML. |
| `replyTo` | string |  | 所回复邮件的 Message-ID：副本会归入该会话。 |
| `signature` | boolean |  | `false` 发送时没有邮箱签名 。 |
| `bcc` | string | string[] |  | 密送。只有发件人在“已发送”中的副本会显示。 |
| `attachments` | object[] |  | `{ filename, content, contentType?, cid? }`，或在 Node 中使用 `{ path }`。`content`：字节、Blob 或字符串（UTF-8 文本，或配合 `encoding: "base64"` 的 base64）。设置 `cid` 后，文件会以 `<img src="cid:…">` 的形式显示在 HTML 中。总计 25 MB，最多 20 个文件；可执行文件会被拒绝，因为 Gmail 和 Outlook 会因此拒收整封邮件。 |

## 未履行被接受的未履行 {#accepted}

> **当信件排队时的接力手回接**
>
> 事后发生的事情没有告诉我们。 向一个人报告“ 发送” 意味着它被接受—— 真实的,而不是同样的事情。 id是发送文件夹中存档的副本, 这样发送就可以被读取。

## 中继 表示哪个地址真的可见 {#relay}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `relay.from` | string |  | **收件人实际看到的地址** |
| `relay.aligned` | boolean |  | 是否在这个邮箱的域名下 |
| `relay.warning` | string|null |  | 为什么,当它没有。 |

以客户没有选择的名字发送的信息, 却毫无遗漏, 却被写成错误。 域的存在可以让人知道。

## 未验证的主机被拒绝 {#unverified}

拒绝是可以修复的,可以验证域名,借出发送者是白标签承诺的崩溃,而过滤器则看起来像劫机。

## 签名添加 {#signature}

如果邮箱有一个,它会以图像来移动 **内** 显示没有“装入远程图像”——这是可靠地将图片送到接收者的唯一方法。

带有签名的文本发送即为电文,但两个部分都构成电文; HTML- 仅发送的文本部分没有被给予一个发明的文本部分,而该部分将单独携带签名。

## 费用 {#cost}

`credits` 中继电话之前的信用额如果中继电话拒绝,则全额退还。

- [update()](/zh/sdk/ref/mailbox/update): 设定签名。
- [messages.list()](/zh/sdk/ref/mailbox/messages/list): 发送文件夹 。
- [send_mail](/zh/sdk/agent/tools/send-mail): 派来的一个特工

```python
sent = box.send(
    to=["someone@example.net"],
    bcc=["accounting@example.com"],
    subject="Your invoice",
    html='<h1>Thank you</h1><img src="cid:logo">',
    text="Thank you",                       # plain-text fallback
    attachments=[
        {"filename": "invoice.pdf", "content": pdf_bytes, "content_type": "application/pdf"},
        {"filename": "logo.png", "content": logo_bytes, "cid": "logo"},   # shown inside the HTML
        {"path": "quote.pdf"},
    ],
)

# {"id", "relay": {"name", "from", "aligned", "warning"}, "credits",
#  "attachments": [{"filename", "size", "contentType", "inline"}]}
```
