cloudflare
Version:
The official TypeScript library for the Cloudflare API
307 lines • 12.7 kB
TypeScript
import { APIResource } from "../../core/resource.js";
import * as SuppressionsAPI from "./suppressions.js";
import { BaseSuppressions, SuppressionCreateParams, SuppressionCreateResponse, SuppressionDeleteParams, SuppressionDeleteResponse, SuppressionEditParams, SuppressionEditResponse, SuppressionGetParams, SuppressionGetResponse, SuppressionImportParams, SuppressionImportResponse, SuppressionListParams, SuppressionListResponse, SuppressionListResponsesCursorPagination, Suppressions } from "./suppressions.js";
import * as SubdomainsAPI from "./subdomains/subdomains.js";
import { BaseSubdomains, SubdomainCreateParams, SubdomainCreateResponse, SubdomainDeleteParams, SubdomainDeleteResponse, SubdomainEditParams, SubdomainEditResponse, SubdomainGetParams, SubdomainGetResponse, SubdomainListParams, SubdomainListResponse, SubdomainListResponsesSinglePage, Subdomains } from "./subdomains/subdomains.js";
import { APIPromise } from "../../core/api-promise.js";
import { RequestOptions } from "../../internal/request-options.js";
export declare class BaseEmailSending extends APIResource {
static readonly _key: readonly ['emailSending'];
/**
* 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.
*
* @example
* ```ts
* const response = await client.emailSending.send({
* account_id: 'account_id',
* from: 'sender@example.com',
* subject: 'Monthly Report',
* });
* ```
*/
send(params: EmailSendingSendParams, options?: RequestOptions): APIPromise<EmailSendingSendResponse>;
/**
* Send a raw RFC 5322 (MIME) email for the specified account. Provide the full
* MIME message plus the SMTP envelope (from and recipients).
*
* @example
* ```ts
* const response = await client.emailSending.sendRaw({
* account_id: 'account_id',
* from: 'sender@example.com',
* mime_message:
* 'From: sender@example.com\r\nTo: recipient@example.com\r\nSubject: Hello\r\nContent-Type: text/plain\r\n\r\nHello, World!',
* recipients: ['recipient@example.com'],
* });
* ```
*/
sendRaw(params: EmailSendingSendRawParams, options?: RequestOptions): APIPromise<EmailSendingSendRawResponse>;
}
export declare class EmailSending extends BaseEmailSending {
suppressions: SuppressionsAPI.Suppressions;
subdomains: SubdomainsAPI.Subdomains;
}
export interface EmailSendingSendResponse {
/**
* Email addresses to which the message was delivered immediately.
*/
delivered: Array<string>;
/**
* Message ID of the sent email.
*/
message_id: string;
/**
* Email addresses that permanently bounced.
*/
permanent_bounces: Array<string>;
/**
* Email addresses for which delivery was queued for later.
*/
queued: 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.
*/
suppressed_recipients: Array<string>;
}
export interface EmailSendingSendRawResponse {
/**
* Email addresses to which the message was delivered immediately.
*/
delivered: Array<string>;
/**
* Message ID of the sent email.
*/
message_id: string;
/**
* Email addresses that permanently bounced.
*/
permanent_bounces: Array<string>;
/**
* Email addresses for which delivery was queued for later.
*/
queued: 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.
*/
suppressed_recipients: Array<string>;
}
export interface EmailSendingSendParams {
/**
* Path param: Identifier of the account.
*/
account_id: string;
/**
* Body param: Sender email address. Either a plain string or an object with
* address and name.
*/
from: string | EmailSendingSendParams.EmailSendingEmailAddressObject;
/**
* Body param: Email subject line.
*/
subject: string;
/**
* Body param: File attachments and inline images.
*/
attachments?: Array<EmailSendingSendParams.EmailSendingEmailInlineAttachment | EmailSendingSendParams.EmailSendingEmailAttachment>;
/**
* Body param: Blind carbon copy recipient(s). Optional. A single email string, a
* named address object, or an array of either.
*/
bcc?: string | EmailSendingSendParams.EmailSendingEmailAddressObject | Array<string | EmailSendingSendParams.EmailSendingEmailAddressObject>;
/**
* Body param: Carbon copy recipient(s). Optional. A single email string, a named
* address object, or an array of either.
*/
cc?: string | EmailSendingSendParams.EmailSendingEmailAddressObject | Array<string | EmailSendingSendParams.EmailSendingEmailAddressObject>;
/**
* Body param: Custom email headers as key-value pairs.
*/
headers?: {
[]: string;
};
/**
* Body param: HTML body of the email. Provide at least one of text or html
* (non-empty).
*/
html?: string;
/**
* Body param: Reply-to address. Either a plain string or an object with address
* and name.
*/
reply_to?: string | EmailSendingSendParams.EmailSendingEmailAddressObject;
/**
* Body param: Plain text body of the email. Provide at least one of text or html
* (non-empty).
*/
text?: string;
/**
* Body param: Recipient(s). Optional if cc or bcc is provided. A single email
* string, a named address object, or an array of either.
*/
to?: string | EmailSendingSendParams.EmailSendingEmailAddressObject | Array<string | EmailSendingSendParams.EmailSendingEmailAddressObject>;
}
export declare namespace EmailSendingSendParams {
interface EmailSendingEmailAddressObject {
/**
* Email address (e.g., 'user@example.com').
*/
address: string;
/**
* 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.
*/
name?: string | null;
}
interface EmailSendingEmailInlineAttachment {
/**
* Base64-encoded content of the attachment.
*/
content: string;
/**
* Content ID used to reference this attachment in HTML via cid: URI (e.g.,
* <img src="cid:logo">).
*/
content_id: string;
/**
* Use 'inline' to embed the attachment in the email body.
*/
disposition: 'inline';
/**
* Filename for the attachment.
*/
filename: string;
/**
* MIME type of the attachment (e.g., 'image/png', 'text/plain').
*/
type: string;
}
interface EmailSendingEmailAttachment {
/**
* Base64-encoded content of the attachment.
*/
content: string;
/**
* Use 'attachment' for a standard file attachment.
*/
disposition: 'attachment';
/**
* Filename for the attachment.
*/
filename: string;
/**
* MIME type of the attachment (e.g., 'application/pdf', 'text/plain').
*/
type: string;
}
interface EmailSendingEmailAddressObject {
/**
* Email address (e.g., 'user@example.com').
*/
address: string;
/**
* 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.
*/
name?: string | null;
}
interface EmailSendingEmailAddressObject {
/**
* Email address (e.g., 'user@example.com').
*/
address: string;
/**
* 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.
*/
name?: string | null;
}
interface EmailSendingEmailAddressObject {
/**
* Email address (e.g., 'user@example.com').
*/
address: string;
/**
* 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.
*/
name?: string | null;
}
interface EmailSendingEmailAddressObject {
/**
* Email address (e.g., 'user@example.com').
*/
address: string;
/**
* 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.
*/
name?: string | null;
}
interface EmailSendingEmailAddressObject {
/**
* Email address (e.g., 'user@example.com').
*/
address: string;
/**
* 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.
*/
name?: string | null;
}
interface EmailSendingEmailAddressObject {
/**
* Email address (e.g., 'user@example.com').
*/
address: string;
/**
* 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.
*/
name?: string | null;
}
interface EmailSendingEmailAddressObject {
/**
* Email address (e.g., 'user@example.com').
*/
address: string;
/**
* 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.
*/
name?: string | null;
}
}
export interface EmailSendingSendRawParams {
/**
* Path param: Identifier of the account.
*/
account_id: string;
/**
* Body param: Sender email address.
*/
from: 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.
*/
mime_message: string;
/**
* Body param: List of recipient email addresses.
*/
recipients: Array<string>;
}
export declare namespace EmailSending {
export { type EmailSendingSendResponse as EmailSendingSendResponse, type EmailSendingSendRawResponse as EmailSendingSendRawResponse, type EmailSendingSendParams as EmailSendingSendParams, type EmailSendingSendRawParams as EmailSendingSendRawParams, };
export { Suppressions as Suppressions, BaseSuppressions as BaseSuppressions, type SuppressionCreateResponse as SuppressionCreateResponse, type SuppressionListResponse as SuppressionListResponse, type SuppressionDeleteResponse as SuppressionDeleteResponse, type SuppressionEditResponse as SuppressionEditResponse, type SuppressionGetResponse as SuppressionGetResponse, type SuppressionImportResponse as SuppressionImportResponse, type SuppressionListResponsesCursorPagination as SuppressionListResponsesCursorPagination, type SuppressionCreateParams as SuppressionCreateParams, type SuppressionListParams as SuppressionListParams, type SuppressionDeleteParams as SuppressionDeleteParams, type SuppressionEditParams as SuppressionEditParams, type SuppressionGetParams as SuppressionGetParams, type SuppressionImportParams as SuppressionImportParams, };
export { Subdomains as Subdomains, BaseSubdomains as BaseSubdomains, type SubdomainCreateResponse as SubdomainCreateResponse, type SubdomainListResponse as SubdomainListResponse, type SubdomainDeleteResponse as SubdomainDeleteResponse, type SubdomainEditResponse as SubdomainEditResponse, type SubdomainGetResponse as SubdomainGetResponse, type SubdomainListResponsesSinglePage as SubdomainListResponsesSinglePage, type SubdomainCreateParams as SubdomainCreateParams, type SubdomainListParams as SubdomainListParams, type SubdomainDeleteParams as SubdomainDeleteParams, type SubdomainEditParams as SubdomainEditParams, type SubdomainGetParams as SubdomainGetParams, };
}
//# sourceMappingURL=email-sending.d.ts.map