## Send an email using the builder. `client.EmailSending.Send(ctx, params) (*EmailSendingSendResponse, error)` **post** `/accounts/{account_id}/email/sending/send` Send an email using the builder. ### Parameters - `params EmailSendingSendParams` - `AccountID param.Field[string]` Path param: Identifier of the account. - `From param.Field[EmailSendingSendParamsFromUnion]` Body param: Sender email address. Either a plain string or an object with address and name. - `UnionString` - `type EmailSendingSendParamsFromEmailSendingEmailAddressObject struct{…}` - `Address string` Email address (e.g., 'user@example.com'). - `Name string` Display name for the email address (e.g., 'John Doe'). - `Subject param.Field[string]` Body param: Email subject line. - `To param.Field[EmailSendingSendParamsToUnion]` Body param: Recipient(s). A single email string or an array of email strings. - `UnionString` - `type EmailSendingSendParamsToEmailSendingEmailAddressList []string` A list of email address strings. - `Attachments param.Field[[]EmailSendingSendParamsAttachment]` Body param: File attachments and inline images. - `type EmailSendingSendParamsAttachmentsEmailSendingEmailInlineAttachment struct{…}` - `Content string` Base64-encoded content of the attachment. - `ContentID string` Content ID used to reference this attachment in HTML via cid: URI (e.g., ). - `Disposition EmailSendingSendParamsAttachmentsEmailSendingEmailInlineAttachmentDisposition` Must be 'inline'. Indicates the attachment is embedded in the email body. - `const EmailSendingSendParamsAttachmentsEmailSendingEmailInlineAttachmentDispositionInline EmailSendingSendParamsAttachmentsEmailSendingEmailInlineAttachmentDisposition = "inline"` - `Filename string` Filename for the attachment. - `Type string` MIME type of the attachment (e.g., 'image/png', 'text/plain'). - `type EmailSendingSendParamsAttachmentsEmailSendingEmailAttachment struct{…}` - `Content string` Base64-encoded content of the attachment. - `Disposition EmailSendingSendParamsAttachmentsEmailSendingEmailAttachmentDisposition` Must be 'attachment'. Indicates a standard file attachment. - `const EmailSendingSendParamsAttachmentsEmailSendingEmailAttachmentDispositionAttachment EmailSendingSendParamsAttachmentsEmailSendingEmailAttachmentDisposition = "attachment"` - `Filename string` Filename for the attachment. - `Type string` MIME type of the attachment (e.g., 'application/pdf', 'text/plain'). - `Bcc param.Field[EmailSendingSendParamsBccUnion]` Body param: BCC recipient(s). A single email string or an array of email strings. - `UnionString` - `type EmailSendingSendParamsBccEmailSendingEmailAddressList []string` A list of email address strings. - `Cc param.Field[EmailSendingSendParamsCcUnion]` Body param: CC recipient(s). A single email string or an array of email strings. - `UnionString` - `type EmailSendingSendParamsCcEmailSendingEmailAddressList []string` A list of email address strings. - `Headers param.Field[map[string, string]]` Body param: Custom email headers as key-value pairs. - `HTML param.Field[string]` Body param: HTML body of the email. At least one of text or html must be provided. - `ReplyTo param.Field[EmailSendingSendParamsReplyToUnion]` Body param: Reply-to address. Either a plain string or an object with address and name. - `UnionString` - `type EmailSendingSendParamsReplyToEmailSendingEmailAddressObject struct{…}` - `Address string` Email address (e.g., 'user@example.com'). - `Name string` Display name for the email address (e.g., 'John Doe'). - `Text param.Field[string]` Body param: Plain text body of the email. At least one of text or html must be provided. ### Returns - `type EmailSendingSendResponse struct{…}` - `Delivered []string` Email addresses to which the message was delivered immediately. - `PermanentBounces []string` Email addresses that permanently bounced. - `Queued []string` Email addresses for which delivery was queued for later. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/email_sending" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/shared" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.EmailSending.Send(context.TODO(), email_sending.EmailSendingSendParams{ AccountID: cloudflare.F("account_id"), From: cloudflare.F[email_sending.EmailSendingSendParamsFromUnion](shared.UnionString("sender@example.com")), Subject: cloudflare.F("Monthly Report"), To: cloudflare.F[email_sending.EmailSendingSendParamsToUnion](email_sending.EmailSendingSendParamsToEmailSendingEmailAddressList([]string{"recipient@example.com"})), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Delivered) } ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "delivered": [ "recipient@example.com" ], "permanent_bounces": [ "dev@stainless.com" ], "queued": [ "dev@stainless.com" ] }, "success": true, "result_info": { "count": 0, "per_page": 0, "total_count": 0, "cursor": "cursor", "page": 0 } } ```