---
title: Send a raw MIME email
---

[Skip to content](#_top)

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

[Email Sending](https://developers.cloudflare.com/api/go/resources/email_sending)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Send a raw MIME email

client.EmailSending.SendRaw(ctx, params) (\*[EmailSendingSendRawResponse](<https://developers.cloudflare.com/api/go/resources/email_sending#(resource)%20email_sending%20%3E%20(model)%20EmailSendingSendRawResponse%20%3E%20(schema)>), error)

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

Send a raw RFC 5322 (MIME) email for the specified account. Provide the full MIME message plus the SMTP envelope (from and recipients).

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



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

**Example:**<code>X-Auth-Email: user@example.com</code>

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

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### ParametersExpand Collapse

<details>

<summary>

params EmailSendingSendRawParams

</summary>

AccountID param.Field\[string]

Path param: Identifier of the account.

<a href="#(resource)%20email_sending%20%3E%20(method)%20send_raw%20%3E%20(params)%20default%20%3E%20(param)%20account_id">Link to this property</a>

From param.Field\[string]

Body param: Sender email address.

<a href="#(resource)%20email_sending%20%3E%20(method)%20send_raw%20%3E%20(params)%20default%20%3E%20(param)%20from">Link to this property</a>

MimeMessage param.Field\[string]

Body param: The full MIME-encoded email message. Should include standard RFC 5322 headers such as From, To, Subject, and Content-Type. The from and recipients fields in the request body control SMTP envelope routing; the From and To headers in the MIME message control what the recipient’s email client displays.

<a href="#(resource)%20email_sending%20%3E%20(method)%20send_raw%20%3E%20(params)%20default%20%3E%20(param)%20mime_message">Link to this property</a>

Recipients param.Field\[\[]string]

Body param: List of recipient email addresses.

<a href="#(resource)%20email_sending%20%3E%20(method)%20send_raw%20%3E%20(params)%20default%20%3E%20(param)%20recipients">Link to this property</a>

</details>

[Link to this property](<#(resource)%20email_sending%20%3E%20(method)%20send_raw%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type EmailSendingSendRawResponse struct{…}

</summary>

Delivered \[]string

Email addresses to which the message was delivered immediately.

<a href="#(resource)%20email_sending%20%3E%20(model)%20EmailSendingSendRawResponse%20%3E%20(schema)%20%3E%20(property)%20delivered">Link to this property</a>

MessageID string

Message ID of the sent email.

<a href="#(resource)%20email_sending%20%3E%20(model)%20EmailSendingSendRawResponse%20%3E%20(schema)%20%3E%20(property)%20message_id">Link to this property</a>

PermanentBounces \[]string

Email addresses that permanently bounced.

<a href="#(resource)%20email_sending%20%3E%20(model)%20EmailSendingSendRawResponse%20%3E%20(schema)%20%3E%20(property)%20permanent_bounces">Link to this property</a>

Queued \[]string

Email addresses for which delivery was queued for later.

<a href="#(resource)%20email_sending%20%3E%20(model)%20EmailSendingSendRawResponse%20%3E%20(schema)%20%3E%20(property)%20queued">Link to this property</a>

SuppressedRecipients \[]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.

<a href="#(resource)%20email_sending%20%3E%20(model)%20EmailSendingSendRawResponse%20%3E%20(schema)%20%3E%20(property)%20suppressed_recipients">Link to this property</a>

</details>

[Link to this property](<#(resource)%20email_sending%20%3E%20(model)%20EmailSendingSendRawResponse%20%3E%20(schema)>)

### Send a raw MIME email

Go

HTTPTypeScriptPythonGoTerraform

```
package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/email_sending"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.EmailSending.SendRaw(context.TODO(), email_sending.EmailSendingSendRawParams{
    AccountID: cloudflare.F("account_id"),
    From: cloudflare.F("sender@example.com"),
    MimeMessage: cloudflare.F("From: sender@example.com\r\nTo: recipient@example.com\r\nSubject: Hello\r\nContent-Type: text/plain\r\n\r\nHello, World!"),
    Recipients: cloudflare.F([]string{"recipient@example.com"}),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.MessageID)
}
```

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
  }
}
```