CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-aws-sdk--client-ses

AWS SDK for JavaScript SES Client for Node.js, Browser and React Native

Pending
Overview
Eval results
Files

AWS SDK for JavaScript SES Client

The AWS SDK for JavaScript SES Client provides a comprehensive API for Amazon Simple Email Service (SES), enabling developers to send emails, manage identities, configure receipt processing, create templates, and analyze email performance. This package offers both low-level command-based and high-level aggregated client interfaces with full TypeScript support for Node.js, browser, and React Native environments.

Package Information

  • Package Name: @aws-sdk/client-ses
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install @aws-sdk/client-ses

Core Imports

import { SESClient, SendEmailCommand } from "@aws-sdk/client-ses";

For aggregated client:

import { SES } from "@aws-sdk/client-ses";

CommonJS:

const { SESClient, SendEmailCommand } = require("@aws-sdk/client-ses");

Basic Usage

import { SESClient, SendEmailCommand } from "@aws-sdk/client-ses";

// Initialize client
const client = new SESClient({ region: "us-east-1" });

// Send an email
const command = new SendEmailCommand({
  Source: "sender@example.com",
  Destination: {
    ToAddresses: ["recipient@example.com"],
  },
  Message: {
    Subject: { Data: "Test Email" },
    Body: {
      Text: { Data: "Hello from AWS SES!" },
    },
  },
});

try {
  const response = await client.send(command);
  console.log("Email sent successfully:", response.MessageId);
} catch (error) {
  console.error("Error sending email:", error);
}

Architecture

The AWS SES SDK is built around several key components:

  • Client Classes: SESClient for command-based operations and SES for convenient method shortcuts
  • Command Pattern: Individual commands for each SES operation (71 commands)
  • Modular Imports: Import only needed commands to reduce bundle size
  • Multi-Environment Support: Works in Node.js, browsers, and React Native
  • TypeScript Integration: Full type safety with comprehensive interfaces and error types
  • Middleware Stack: Extensible request/response processing pipeline

Capabilities

Email Sending

Core email sending functionality with support for formatted emails, raw emails with attachments, templated emails, and bulk operations.

interface SendEmailCommandInput {
  Source: string;
  Destination: Destination;
  Message: Message;
  ReplyToAddresses?: string[];
  ReturnPath?: string;
  Tags?: MessageTag[];
  ConfigurationSetName?: string;
}

interface Destination {
  ToAddresses?: string[];
  CcAddresses?: string[];
  BccAddresses?: string[];
}

interface Message {
  Subject: Content;
  Body: Body;
}

interface Content {
  Data: string;
  Charset?: string;
}

interface Body {
  Text?: Content;
  Html?: Content;
}

Email Sending

Identity Management

Comprehensive identity verification and configuration system for email addresses and domains, including DKIM, Mail-From domain setup, and authorization policies.

interface VerifyEmailIdentityCommandInput {
  EmailAddress: string;
}

interface VerifyDomainIdentityCommandInput {
  Domain: string;
}

interface GetIdentityVerificationAttributesCommandInput {
  Identities: string[];
}

interface IdentityVerificationAttributes {
  VerificationStatus: VerificationStatus;
  VerificationToken?: string;
}

Identity Management

Template Management

Email template system for creating reusable email formats with variable substitution and bulk email operations.

interface CreateTemplateCommandInput {
  Template: Template;
}

interface Template {
  TemplateName: string;
  Subject?: string;
  TextPart?: string;
  HtmlPart?: string;
}

interface SendTemplatedEmailCommandInput {
  Source: string;
  Destination: Destination;
  Template: string;
  TemplateData: string;
  ConfigurationSetName?: string;
}

Template Management

Configuration Sets

Email tracking and analytics configuration with event destinations, reputation metrics, and delivery options for detailed email performance monitoring.

interface CreateConfigurationSetCommandInput {
  ConfigurationSet: ConfigurationSet;
}

interface ConfigurationSet {
  Name: string;
}

interface CreateConfigurationSetEventDestinationCommandInput {
  ConfigurationSetName: string;
  EventDestination: EventDestination;
}

interface EventDestination {
  Name: string;
  Enabled?: boolean;
  MatchingEventTypes: EventType[];
  CloudWatchDestination?: CloudWatchDestination;
  KinesisFirehoseDestination?: KinesisFirehoseDestination;
  SNSDestination?: SNSDestination;
}

Configuration Sets

Receipt Processing

Comprehensive email receipt processing system with rules, rule sets, and actions for handling incoming emails automatically.

interface CreateReceiptRuleCommandInput {
  RuleSetName: string;
  After?: string;
  Rule: ReceiptRule;
}

interface ReceiptRule {
  Name: string;
  Enabled?: boolean;
  TlsPolicy?: TlsPolicy;
  Recipients?: string[];
  Actions?: ReceiptAction[];
  ScanEnabled?: boolean;
}

interface ReceiptAction {
  S3Action?: S3Action;
  BounceAction?: BounceAction;
  LambdaAction?: LambdaAction;
  SNSAction?: SNSAction;
  AddHeaderAction?: AddHeaderAction;
  WorkmailAction?: WorkmailAction;
  StopAction?: StopAction;
}

Receipt Processing

Core Types

Client Configuration

interface SESClientConfig {
  region?: string;
  credentials?: AwsCredentialIdentityProvider;
  endpoint?: string;
  maxAttempts?: number;
  logger?: Logger;
  requestHandler?: RequestHandler;
}

class SESClient {
  constructor(configuration: SESClientConfig);
  send<InputType, OutputType>(
    command: Command<InputType, OutputType>
  ): Promise<OutputType>;
  destroy(): void;
}

Common Enums

type VerificationStatus = "Pending" | "Success" | "Failed" | "TemporaryFailure" | "NotStarted";
type IdentityType = "EmailAddress" | "Domain";
type EventType = "send" | "reject" | "bounce" | "complaint" | "delivery" | "click" | "open" | "renderingFailure";
type TlsPolicy = "Require" | "Optional";
type BounceType = "DoesNotExist" | "MessageTooLarge" | "ExceededQuota" | "ContentRejected" | "Undefined" | "TemporaryFailure";
type NotificationType = "Bounce" | "Complaint" | "Delivery";

Error Types

class SESServiceException extends Error {
  name: string;
  message: string;
  $fault: "client" | "server";
  $metadata: ResponseMetadata;
}

class MessageRejected extends SESServiceException {}
class LimitExceededException extends SESServiceException {}
class AccountSendingPausedException extends SESServiceException {}
class ConfigurationSetDoesNotExistException extends SESServiceException {}
class TemplateDoesNotExistException extends SESServiceException {}

Statistics and Monitoring

Account-level sending statistics, quotas, and monitoring capabilities for tracking email performance and compliance.

interface GetSendQuotaCommandOutput {
  Max24HourSend?: number;
  MaxSendRate?: number;
  SentLast24Hours?: number;
}

interface GetSendStatisticsCommandOutput {
  SendDataPoints?: SendDataPoint[];
}

interface SendDataPoint {
  Timestamp?: Date;
  DeliveryAttempts?: number;
  Bounces?: number;
  Complaints?: number;
  Rejects?: number;
}

Statistics and Monitoring

Pagination and Waiters

Utilities for handling large result sets and waiting for asynchronous operations to complete.

function paginateListIdentities(
  config: SESPaginationConfiguration,
  input: ListIdentitiesCommandInput
): Paginator<ListIdentitiesCommandOutput>;

function waitForIdentityExists(
  params: WaiterConfiguration<SESClient>,
  input: GetIdentityVerificationAttributesCommandInput
): Promise<WaiterResult>;

Utilities

Install with Tessl CLI

npx tessl i tessl/npm-aws-sdk--client-ses
Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@aws-sdk/client-ses@3.879.x
Publish Source
CLI
Badge
tessl/npm-aws-sdk--client-ses badge