---
title: Send an email
---

[Skip to content](#%5Ftop) 

[API Reference](https://developers.cloudflare.com/api/typescript)

[Email Sending](https://developers.cloudflare.com/api/typescript/resources/email%5Fsending)

Copy Markdown

Open in **Claude**

Open in **ChatGPT**

Open in **Cursor**

---

**Copy Markdown**

**View as Markdown**

# Send an email

client.emailSending.send(EmailSendingSendParams { account\_id, from, subject, 8 more } params, RequestOptionsoptions?): [EmailSendingSendResponse](https://developers.cloudflare.com/api/typescript/resources/email%5Fsending#%28resource%29%20email%5Fsending%20%3E%20%28model%29%20email%5Fsending%5Fsend%5Fresponse%20%3E%20%28schema%29) { delivered, message\_id, permanent\_bounces, 2 more } 

POST/accounts/{account\_id}/email/sending/send

Send an email for the specified account using the structured builder. Provide the sender, recipients, subject, and at least one of text or html; attachments are optional.

##### Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. [Create a token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/).

**Example:**`Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY`

API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

**Example:**`X-Auth-Email: user@example.com`

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

**Example:**`X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194`

##### ParametersExpand Collapse 

params: EmailSendingSendParams { account\_id, from, subject, 8 more } 

account\_id: string

Path param: Identifier of the account.

from: string | EmailSendingEmailAddressObject { address, name } 

Body param: Sender email address. Either a plain string or an object with address and name.

One of the following:

string

EmailSendingEmailAddressObject { address, name } 

address: string

Email address (e.g., ‘[user@example.com](mailto:user@example.com)’).

name?: string | null

Display name for the email address (e.g., ‘John Doe’). Optional; set to null or leave it unset to send the address on its own.

subject: string

Body param: Email subject line.

attachments?: Array<EmailSendingEmailInlineAttachment { content, content\_id, disposition, 2 more } | EmailSendingEmailAttachment { content, disposition, filename, type } \>

Body param: File attachments and inline images.

One of the following:

EmailSendingEmailInlineAttachment { content, content\_id, disposition, 2 more } 

content: string

Base64-encoded content of the attachment.

content\_id: string

Content ID used to reference this attachment in HTML via cid: URI (e.g., ![](cid:logo)).

disposition: "inline"

Use ‘inline’ to embed the attachment in the email body.

filename: string

Filename for the attachment.

type: string

MIME type of the attachment (e.g., ‘image/png’, ‘text/plain’).

EmailSendingEmailAttachment { content, disposition, filename, type } 

content: string

Base64-encoded content of the attachment.

disposition: "attachment"

Use ‘attachment’ for a standard file attachment.

filename: string

Filename for the attachment.

type: string

MIME type of the attachment (e.g., ‘application/pdf’, ‘text/plain’).

bcc?: string | EmailSendingEmailAddressObject { address, name } | Array<string | EmailSendingEmailAddressObject { address, name } \>

Body param: Recipient(s). Optional if cc or bcc is provided. A single email string, a named address object, or an array of either.

One of the following:

string

EmailSendingEmailAddressObject { address, name } 

address: string

Email address (e.g., ‘[user@example.com](mailto:user@example.com)’).

name?: string | null

Display name for the email address (e.g., ‘John Doe’). Optional; set to null or leave it unset to send the address on its own.

Array<string | EmailSendingEmailAddressObject { address, name } \>

string

EmailSendingEmailAddressObject { address, name } 

address: string

Email address (e.g., ‘[user@example.com](mailto:user@example.com)’).

name?: string | null

Display name for the email address (e.g., ‘John Doe’). Optional; set to null or leave it unset to send the address on its own.

cc?: string | EmailSendingEmailAddressObject { address, name } | Array<string | EmailSendingEmailAddressObject { address, name } \>

Body param: Recipient(s). Optional if cc or bcc is provided. A single email string, a named address object, or an array of either.

One of the following:

string

EmailSendingEmailAddressObject { address, name } 

address: string

Email address (e.g., ‘[user@example.com](mailto:user@example.com)’).

name?: string | null

Display name for the email address (e.g., ‘John Doe’). Optional; set to null or leave it unset to send the address on its own.

Array<string | EmailSendingEmailAddressObject { address, name } \>

string

EmailSendingEmailAddressObject { address, name } 

address: string

Email address (e.g., ‘[user@example.com](mailto:user@example.com)’).

name?: string | null

Display name for the email address (e.g., ‘John Doe’). Optional; set to null or leave it unset to send the address on its own.

headers?: Record<string, string\>

Body param: Custom email headers as key-value pairs.

html?: string

Body param: HTML body of the email. Provide at least one of text or html (non-empty).

reply\_to?: string | EmailSendingEmailAddressObject { address, name } 

Body param: Reply-to address. Either a plain string or an object with address and name.

One of the following:

string

EmailSendingEmailAddressObject { address, name } 

address: string

Email address (e.g., ‘[user@example.com](mailto:user@example.com)’).

name?: string | null

Display name for the email address (e.g., ‘John Doe’). Optional; set to null or leave it unset to send the address on its own.

text?: string

Body param: Plain text body of the email. Provide at least one of text or html (non-empty).

to?: string | EmailSendingEmailAddressObject { address, name } | Array<string | EmailSendingEmailAddressObject { address, name } \>

Body param: Recipient(s). Optional if cc or bcc is provided. A single email string, a named address object, or an array of either.

One of the following:

string

EmailSendingEmailAddressObject { address, name } 

address: string

Email address (e.g., ‘[user@example.com](mailto:user@example.com)’).

name?: string | null

Display name for the email address (e.g., ‘John Doe’). Optional; set to null or leave it unset to send the address on its own.

Array<string | EmailSendingEmailAddressObject { address, name } \>

string

EmailSendingEmailAddressObject { address, name } 

address: string

Email address (e.g., ‘[user@example.com](mailto:user@example.com)’).

name?: string | null

Display name for the email address (e.g., ‘John Doe’). Optional; set to null or leave it unset to send the address on its own.

##### ReturnsExpand Collapse 

EmailSendingSendResponse { delivered, message\_id, permanent\_bounces, 2 more } 

delivered: Array<string\>

Email addresses to which the message was delivered immediately.

message\_id: string

Message ID of the sent email.

permanent\_bounces: Array<string\>

Email addresses that permanently bounced.

queued: Array<string\>

Email addresses for which delivery was queued for later.

suppressed\_recipients: Array<string\>

Email addresses dropped because they are on the suppression list. Returned when suppressed-recipient dropping is enabled for the sending subdomain; otherwise the request fails instead.

### Send an email

TypeScript

HTTPHTTP

TypeScriptTypeScript

PythonPython

GoGo

TerraformTerraform

```
import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const response = await client.emailSending.send({
  account_id: 'account_id',
  from: 'sender@example.com',
  subject: 'Monthly Report',
});

console.log(response.message_id);
```

200 example

```
{
  "errors": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "result": {
    "delivered": [
      "recipient@example.com"
    ],
    "message_id": "<aB3xK9mP2qR5sT8uV0wX1yZ4cD6fG7hJ9kL0@example.com>",
    "permanent_bounces": [
      "string"
    ],
    "queued": [
      "string"
    ],
    "suppressed_recipients": [
      "string"
    ]
  },
  "success": true,
  "result_info": {
    "count": 0,
    "per_page": 0,
    "total_count": 0,
    "cursor": "cursor",
    "page": 0
  }
}
```

##### Returns Examples

200 example

```
{
  "errors": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "result": {
    "delivered": [
      "recipient@example.com"
    ],
    "message_id": "<aB3xK9mP2qR5sT8uV0wX1yZ4cD6fG7hJ9kL0@example.com>",
    "permanent_bounces": [
      "string"
    ],
    "queued": [
      "string"
    ],
    "suppressed_recipients": [
      "string"
    ]
  },
  "success": true,
  "result_info": {
    "count": 0,
    "per_page": 0,
    "total_count": 0,
    "cursor": "cursor",
    "page": 0
  }
}
```