ses

package
v0.0.1-alpha.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package ses provides emulation of Amazon Simple Email Service (SES v1).

Both AWS SDK v1 Query protocol clients (aws-sdk-go-v2/service/ses, boto3 ses, @aws-sdk/client-ses) and SES v2 REST-JSON clients (aws-sdk-go-v2/service/sesv2, boto3 sesv2, @aws-sdk/client-sesv2) are supported.

SES v1 (Query protocol) implemented operations:

  • SendEmail, SendRawEmail
  • VerifyEmailIdentity, VerifyDomainIdentity
  • ListIdentities, ListVerifiedEmailAddresses
  • GetIdentityVerificationAttributes
  • DeleteIdentity
  • GetSendQuota

SES v2 (REST-JSON) implemented operations:

  • POST /v2/email/outbound-emails (SendEmail)
  • PUT /v2/email/identities
  • GET /v2/email/identities
  • GET /v2/email/identities/{EmailIdentity}
  • DELETE /v2/email/identities/{EmailIdentity}

Admin endpoints (for web console):

GET  /_overcast/ses/identities
DELETE /_overcast/ses/identities/{identity}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler holds SES handler dependencies.

func (*Handler) CreateTemplate

func (h *Handler) CreateTemplate(w http.ResponseWriter, r *http.Request)

CreateTemplate creates a new SES email template.

func (*Handler) DeleteIdentity

func (h *Handler) DeleteIdentity(w http.ResponseWriter, r *http.Request)

DeleteIdentity removes a verified identity.

func (*Handler) DeleteTemplate

func (h *Handler) DeleteTemplate(w http.ResponseWriter, r *http.Request)

DeleteTemplate deletes an SES email template.

func (*Handler) GetIdentityVerificationAttributes

func (h *Handler) GetIdentityVerificationAttributes(w http.ResponseWriter, r *http.Request)

GetIdentityVerificationAttributes returns verification status for identities.

func (*Handler) GetSendQuota

func (h *Handler) GetSendQuota(w http.ResponseWriter, r *http.Request)

GetSendQuota returns a generous fake quota.

func (*Handler) GetSendStatisticsStub

func (h *Handler) GetSendStatisticsStub(w http.ResponseWriter, r *http.Request)

GetSendStatisticsStub returns an empty list instead of 501 because some SDK clients call this on initialisation and a 501 would abort the workflow.

func (*Handler) GetTemplate

func (h *Handler) GetTemplate(w http.ResponseWriter, r *http.Request)

GetTemplate retrieves an SES email template by name.

func (*Handler) ListIdentities

func (h *Handler) ListIdentities(w http.ResponseWriter, r *http.Request)

ListIdentities returns all verified identities.

func (*Handler) ListTemplates

func (h *Handler) ListTemplates(w http.ResponseWriter, r *http.Request)

ListTemplates lists all SES email templates (name and creation time only).

func (*Handler) ListVerifiedEmailAddresses

func (h *Handler) ListVerifiedEmailAddresses(w http.ResponseWriter, r *http.Request)

ListVerifiedEmailAddresses returns all email (not domain) verified identities. This is the legacy v1 API — clients should prefer ListIdentities.

func (*Handler) SendEmail

func (h *Handler) SendEmail(w http.ResponseWriter, r *http.Request)

SendEmail implements the SES v1 SendEmail operation. Request fields (form-encoded):

Source, Destination.ToAddresses.member.N,
Message.Subject.Data, Message.Body.Text.Data, Message.Body.Html.Data

func (*Handler) SendRawEmail

func (h *Handler) SendRawEmail(w http.ResponseWriter, r *http.Request)

SendRawEmail implements the SES v1 SendRawEmail operation.

func (*Handler) SendTemplatedEmail

func (h *Handler) SendTemplatedEmail(w http.ResponseWriter, r *http.Request)

SendTemplatedEmail renders a template and sends the message. Template variable substitution uses Go's strings.NewReplacer to replace {{key}} tokens — sufficient for the compat test suite.

func (*Handler) SetIdentityFeedbackForwardingEnabled

func (h *Handler) SetIdentityFeedbackForwardingEnabled(w http.ResponseWriter, r *http.Request)

SetIdentityFeedbackForwardingEnabled records the forwarding preference. For emulation purposes this is a no-op — the call just needs to succeed.

func (*Handler) UpdateTemplate

func (h *Handler) UpdateTemplate(w http.ResponseWriter, r *http.Request)

UpdateTemplate replaces an SES email template.

func (*Handler) V2CreateEmailIdentity

func (h *Handler) V2CreateEmailIdentity(w http.ResponseWriter, r *http.Request)

V2CreateEmailIdentity handles PUT /v2/email/identities.

func (*Handler) V2DeleteEmailIdentity

func (h *Handler) V2DeleteEmailIdentity(w http.ResponseWriter, r *http.Request)

V2DeleteEmailIdentity handles DELETE /v2/email/identities/{EmailIdentity}.

func (*Handler) V2GetEmailIdentity

func (h *Handler) V2GetEmailIdentity(w http.ResponseWriter, r *http.Request)

V2GetEmailIdentity handles GET /v2/email/identities/{EmailIdentity}.

func (*Handler) V2ListEmailIdentities

func (h *Handler) V2ListEmailIdentities(w http.ResponseWriter, r *http.Request)

V2ListEmailIdentities handles GET /v2/email/identities.

func (*Handler) V2SendEmail

func (h *Handler) V2SendEmail(w http.ResponseWriter, r *http.Request)

V2SendEmail handles POST /v2/email/outbound-emails.

func (*Handler) VerifyDomainIdentity

func (h *Handler) VerifyDomainIdentity(w http.ResponseWriter, r *http.Request)

VerifyDomainIdentity marks a domain as verified, returning a fake token.

func (*Handler) VerifyEmailIdentity

func (h *Handler) VerifyEmailIdentity(w http.ResponseWriter, r *http.Request)

VerifyEmailIdentity marks an email address as verified.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service implements router.Service for SES.

func New

func New(cfg *config.Config, store state.Store, logger *zap.Logger, clk clock.Clock) *Service

New returns a configured SES Service.

func (*Service) DispatchQuery

func (s *Service) DispatchQuery(w http.ResponseWriter, r *http.Request)

DispatchQuery satisfies router.QueryDispatcher. SES v1 uses the AWS Query protocol: form-encoded POST body with Action field, XML responses. The router calls r.ParseForm() before invoking this method.

func (*Service) InitBus

func (s *Service) InitBus(bus *events.Bus)

InitBus wires the event bus for SES lifecycle events.

func (*Service) InitEmailDelivery

func (s *Service) InitEmailDelivery(m smtp.Mailer)

InitEmailDelivery wires the SMTP mailer so that SendEmail and SendRawEmail deliver messages. Call this after the router builds the mailer.

func (*Service) Name

func (s *Service) Name() string

Name satisfies router.Service.

func (*Service) Operations

func (s *Service) Operations() []op.Operation

func (*Service) OwnsAction

func (s *Service) OwnsAction(action string) bool

OwnsAction satisfies router.QueryActionOwner. Returns true for every v1 Action this service handles so the router does not try this dispatcher for SNS actions.

func (*Service) RegisterRoutes

func (s *Service) RegisterRoutes(r chi.Router)

RegisterRoutes mounts the SES v2 REST-JSON endpoints and admin routes.

func (*Service) SupportedProtocols

func (s *Service) SupportedProtocols() []codec.Codec

type Template

type Template struct {
	TemplateName string    `json:"template_name"`
	SubjectPart  string    `json:"subject_part,omitempty"`
	TextPart     string    `json:"text_part,omitempty"`
	HtmlPart     string    `json:"html_part,omitempty"`
	CreatedAt    time.Time `json:"created_at"`
}

Template represents an SES email template.

type VerifiedIdentity

type VerifiedIdentity struct {
	Identity  string    `json:"identity"`
	Type      string    `json:"type"` // "email" or "domain"
	Token     string    `json:"token,omitempty"`
	CreatedAt time.Time `json:"created_at"`
}

VerifiedIdentity represents a stored SES verified identity (email or domain).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL