## Send an email
`email_sending.send(EmailSendingSendParams**kwargs) -> EmailSendingSendResponse`
**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.
### Parameters
- `account_id: str`
Identifier of the account.
- `from_: From`
Sender email address. Either a plain string or an object with address and name.
- `str`
An email address as a plain string.
- `class FromEmailSendingEmailAddressObject: …`
- `address: str`
Email address (e.g., 'user@example.com').
- `name: Optional[str]`
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: str`
Email subject line.
- `attachments: Optional[Iterable[Attachment]]`
File attachments and inline images.
- `class AttachmentEmailSendingEmailInlineAttachment: …`
- `content: str`
Base64-encoded content of the attachment.
- `content_id: str`
Content ID used to reference this attachment in HTML via cid: URI (e.g.,
).
- `disposition: Literal["inline"]`
Must be 'inline'. Embeds the attachment in the email body.
- `"inline"`
- `filename: str`
Filename for the attachment.
- `type: str`
MIME type of the attachment (e.g., 'image/png', 'text/plain').
- `class AttachmentEmailSendingEmailAttachment: …`
- `content: str`
Base64-encoded content of the attachment.
- `disposition: Literal["attachment"]`
Must be 'attachment'. Adds a standard file attachment.
- `"attachment"`
- `filename: str`
Filename for the attachment.
- `type: str`
MIME type of the attachment (e.g., 'application/pdf', 'text/plain').
- `bcc: Optional[Bcc]`
BCC recipient(s). A single email string, a named address object, or an array of either.
- `str`
An email address as a plain string.
- `class BccEmailSendingEmailAddressObject: …`
- `address: str`
Email address (e.g., 'user@example.com').
- `name: Optional[str]`
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.
- `Sequence[BccUnionMember2]`
- `str`
An email address as a plain string.
- `class BccUnionMember2EmailSendingEmailAddressObject: …`
- `address: str`
Email address (e.g., 'user@example.com').
- `name: Optional[str]`
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: Optional[Cc]`
CC recipient(s). A single email string, a named address object, or an array of either.
- `str`
An email address as a plain string.
- `class CcEmailSendingEmailAddressObject: …`
- `address: str`
Email address (e.g., 'user@example.com').
- `name: Optional[str]`
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.
- `Sequence[CcUnionMember2]`
- `str`
An email address as a plain string.
- `class CcUnionMember2EmailSendingEmailAddressObject: …`
- `address: str`
Email address (e.g., 'user@example.com').
- `name: Optional[str]`
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: Optional[Dict[str, str]]`
Custom email headers as key-value pairs.
- `html: Optional[str]`
HTML body of the email. Provide at least one of text or html (non-empty).
- `reply_to: Optional[ReplyTo]`
Reply-to address. Either a plain string or an object with address and name.
- `str`
An email address as a plain string.
- `class ReplyToEmailSendingEmailAddressObject: …`
- `address: str`
Email address (e.g., 'user@example.com').
- `name: Optional[str]`
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: Optional[str]`
Plain text body of the email. Provide at least one of text or html (non-empty).
- `to: Optional[To]`
Recipient(s). Optional if cc or bcc is provided. A single email string, a named address object, or an array of either.
- `str`
An email address as a plain string.
- `class ToEmailSendingEmailAddressObject: …`
- `address: str`
Email address (e.g., 'user@example.com').
- `name: Optional[str]`
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.
- `Sequence[ToUnionMember2]`
- `str`
An email address as a plain string.
- `class ToUnionMember2EmailSendingEmailAddressObject: …`
- `address: str`
Email address (e.g., 'user@example.com').
- `name: Optional[str]`
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.
### Returns
- `class EmailSendingSendResponse: …`
- `delivered: List[str]`
Email addresses to which the message was delivered immediately.
- `message_id: str`
Message ID of the sent email.
- `permanent_bounces: List[str]`
Email addresses that permanently bounced.
- `queued: List[str]`
Email addresses for which delivery was queued for later.
### Example
```python
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
response = client.email_sending.send(
account_id="account_id",
from_="sender@example.com",
subject="Monthly Report",
)
print(response.message_id)
```
#### Response
```json
{
"errors": [
{
"code": 0,
"message": "message"
}
],
"messages": [
{
"code": 0,
"message": "message"
}
],
"result": {
"delivered": [
"recipient@example.com"
],
"message_id": "",
"permanent_bounces": [
"string"
],
"queued": [
"string"
]
},
"success": true,
"result_info": {
"count": 0,
"per_page": 0,
"total_count": 0,
"cursor": "cursor",
"page": 0
}
}
```