View Source ExAws.SES (ExAws.SES v2.4.1)

Operations on AWS SES.

See https://docs.aws.amazon.com/ses/latest/APIReference/Welcome.html

Link to this section Summary

Functions

Create a new contact in a contact list.

Create a bulk import job to import contacts from S3.

Delete a contact in a contact list.

Delete contact list.

Delete custom verification email template.

Deletes the specified identity (an email address or a domain) from the list of verified identities.

Delete an email address from list of suppressed destinations.

Deletes an email template.

Show a contact in a contact list.

Show contact list.

Fetch identities verification status and token (for domains).

Get email template

Fetch configuration sets associated with AWS account.

List contact lists.

Show contacts in contact list.

Lists custom verification email templates.

List identities associated with the AWS account

List email templates.

Add an email address to list of suppressed destinations. A suppression reason is mandatory (see t:suppression_reason()).

Send a templated email to multiple destinations.

Send a verification email using a custom template.

Composes an email message.

Send an email via the SES V2 API, which supports list management.

Enables or disables whether Amazon SES forwards notifications as email.

Set whether SNS notifications should include original email headers or not.

Sets the Amazon Simple Notification Service (Amazon SNS) topic to which Amazon SES will publish delivery notifications for emails sent with given identity.

Update a contact in a contact list.

Update a contact list. Only accepts description and topic updates.

Update or create a custom verification email template.

Verifies an email address.

Link to this section Types

Specs

bulk_destination() :: [
  %{destination: destination(), replacement_template_data: binary()}
]
Link to this type

contact_list_destination()

View Source

Specs

contact_list_destination() :: %{
  ContactListImportAction: String.t(),
  ContactListName: String.t()
}

Specs

contact_opt() ::
  {:attributes, String.t()}
  | {:topic_preferences, [topic_preference()]}
  | {:unsubscribe_all, Boolean.t()}
Link to this type

create_contact_list_opt()

View Source

Specs

create_contact_list_opt() ::
  {:description, String.t()}
  | {:tags, [tag()]}
  | {:topics, [%{required(String.t() | atom()) => String.t()}]}

Specs

create_template_opt() :: {:configuration_set_name, String.t()}

Specs

destination() :: %{
  to: [email_address()],
  cc: [email_address()],
  bcc: [email_address()]
}

Specs

destination_v2() :: %{
  optional(:ToAddresses) => [email_address()],
  optional(:CcAddresses) => [email_address()],
  optional(:BccAddresses) => [email_address()]
}

Specs

email_address() :: binary()

Specs

email_content() :: %{
  optional(:Raw) => %{Data: binary()},
  optional(:Simple) => %{
    Body: %{Html: email_field(), Text: email_field()},
    Subject: email_field()
  },
  optional(:Template) => %{
    TemplateArn: String.t(),
    TemplateData: String.t(),
    TemplateName: String.t()
  }
}

Specs

email_field() :: %{optional(:Charset) => String.t(), Data: String.t()}

Specs

import_data_source() :: %{DataFormat: String.t(), S3Url: String.t()}

Specs

import_destination() :: %{
  optional(:ContactListDestination) => contact_list_destination(),
  optional(:SuppressionListDestination) => suppression_list_destination()
}
Link to this type

list_configuration_sets_opt()

View Source

Specs

list_configuration_sets_opt() ::
  {:max_items, pos_integer()} | {:next_token, String.t()}
Link to this type

list_custom_verification_email_templates_opt()

View Source

Specs

list_custom_verification_email_templates_opt() ::
  {:max_results, String.t()} | {:next_token, String.t()}

Specs

list_identities_opt() ::
  {:max_items, pos_integer()}
  | {:next_token, String.t()}
  | {:identity_type, String.t()}

Specs

list_templates_opt() :: {:max_items, pos_integer()} | {:next_token, String.t()}

Specs

list_topic() :: %{required(String.t()) => String.t()}

Specs

message() :: %{
  body: %{
    html: %{data: binary(), charset: binary()},
    text: %{data: binary(), charset: binary()}
  },
  subject: %{data: binary(), charset: binary()}
}

Specs

notification_type() :: :bounce | :complaint | :delivery
Link to this type

send_bulk_templated_email_opt()

View Source

Specs

send_bulk_templated_email_opt() ::
  {:configuration_set_name, String.t()}
  | {:return_path, String.t()}
  | {:return_path_arn, String.t()}
  | {:source_arn, String.t()}
  | {:default_template_data, String.t()}
  | {:reply_to, [email_address()]}
  | {:tags, %{required(String.t() | atom()) => String.t()}}
Link to this type

send_custom_verification_email_opt()

View Source

Specs

send_custom_verification_email_opt() :: {:configuration_set_name, String.t()}

Specs

send_email_opt() ::
  {:configuration_set_name, String.t()}
  | {:reply_to, [email_address()]}
  | {:return_path, String.t()}
  | {:return_path_arn, String.t()}
  | {:source, String.t()}
  | {:source_arn, String.t()}
  | {:tags, %{required(String.t() | atom()) => String.t()}}

Specs

send_email_v2_opt() ::
  {:configuration_set_name, String.t()}
  | {:tags, [tag()]}
  | {:feedback_forwarding_address, String.t()}
  | {:feedback_forwarding_arn, String.t()}
  | {:from_arn, String.t()}
  | {:list_management, %{ContactListName: String.t(), TopicName: String.t()}}
  | {:reply_addresses, [String.t()]}

Specs

send_raw_email_opt() ::
  {:configuration_set_name, String.t()}
  | {:from_arn, String.t()}
  | {:return_path_arn, String.t()}
  | {:source, String.t()}
  | {:source_arn, String.t()}
  | {:tags, %{required(String.t() | atom()) => String.t()}}
Link to this type

send_templated_email_opt()

View Source

Specs

send_templated_email_opt() ::
  {:configuration_set_name, String.t()}
  | {:return_path, String.t()}
  | {:return_path_arn, String.t()}
  | {:source, String.t()}
  | {:source_arn, String.t()}
  | {:reply_to, [email_address()]}
  | {:tags, %{required(String.t() | atom()) => String.t()}}
Link to this type

set_identity_notification_topic_opt()

View Source

Specs

set_identity_notification_topic_opt() :: {:sns_topic, binary()}
Link to this type

suppression_list_destination()

View Source

Specs

suppression_list_destination() :: %{SuppressionListImportAction: String.t()}

Specs

suppression_reason() :: :BOUNCE | :COMPLAINT

Specs

tag() :: %{Key: String.t(), Value: String.t()}

Specs

topic() :: %{
  :DefaultSubscriptionStatus => String.t(),
  optional(:Description) => String.t(),
  DisplayName: String.t(),
  TopicName: String.t()
}

Specs

topic_preference() :: %{TopicName: String.t(), SubscriptionStatus: String.t()}
Link to this type

update_contact_list_opt()

View Source

Specs

update_contact_list_opt() :: {:description, String.t()} | {:topics, [topic()]}
Link to this type

update_custom_verification_email_template_opt()

View Source

Specs

update_custom_verification_email_template_opt() ::
  {:template_name, String.t()}
  | {:from_email_address, String.t()}
  | {:template_subject, String.t()}
  | {:template_content, String.t()}
  | {:success_redirection_url, String.t()}
  | {:failure_redirection_url, String.t()}

Specs

update_template_opt() :: {:configuration_set_name, String.t()}

Link to this section Functions

Link to this function

build_message(html, txt, subject, charset \\ "UTF-8")

View Source

Specs

build_message(binary(), binary(), binary(), binary()) :: message()

Build message object.

Link to this function

create_contact(list_name, email, opts \\ [])

View Source

Specs

create_contact(String.t(), email_address(), [contact_opt()]) ::
  ExAws.Operation.JSON.t()

Create a new contact in a contact list.

Options:

  • :attributes - arbitrary string to be assigned to AWS SES Contact AttributesData
  • :topic_preferences - list of maps for subscriptions to topics. SubscriptionStatus should be one of "OPT_IN" or "OPT_OUT"
  • :unsubscribe_all - causes contact to be unsubscribed from all topics
Link to this function

create_contact_list(list_name, opts \\ [])

View Source

Specs

create_contact_list(String.t(), opts :: [create_contact_list_opt()]) ::
  ExAws.Operation.JSON.t()

Create a contact list via the SES V2 API, see (https://docs.aws.amazon.com/ses/latest/APIReference-V2/).

examples

Examples

ExAws.SES.create_contact_list(
  "Test list",
  "Test description",
  tags: [%{"Key" => "environment", "Value" => "test"}],
  topics: [
    %{
      "TopicName": "test_topic"
      "DisplayName": "Test topic",
      "Description": "Test discription",
      "DefaultSubscriptionStatus": "OPT_IN",
    }
 ]
)
Link to this function

create_custom_verification_email_template(template_name, from_email_address, template_subject, template_content, success_redirection_url, failure_redirection_url)

View Source

Specs

create_custom_verification_email_template(
  String.t(),
  String.t(),
  String.t(),
  String.t(),
  String.t(),
  String.t()
) :: ExAws.Operation.Query.t()

Create a custom verification email template.

Link to this function

create_import_job(data_source, destination)

View Source

Specs

Create a bulk import job to import contacts from S3.

Params:

  • :import_data_source
  • :import_destination - requires either a ContactListDestination or SuppressionListDestination map.
Link to this function

create_template(template_name, subject, html, text, opts \\ [])

View Source

Specs

create_template(
  String.t(),
  String.t(),
  String.t(),
  String.t(),
  opts :: [create_template_opt()]
) ::
  ExAws.Operation.Query.t()

Creates an email template.

Link to this function

delete_contact(list_name, email)

View Source

Specs

delete_contact(String.t(), email_address()) :: ExAws.Operation.JSON.t()

Delete a contact in a contact list.

Link to this function

delete_contact_list(list_name)

View Source

Specs

delete_contact_list(String.t()) :: ExAws.Operation.JSON.t()

Delete contact list.

Link to this function

delete_custom_verification_email_template(template_name)

View Source

Specs

delete_custom_verification_email_template(String.t()) ::
  ExAws.Operation.Query.t()

Delete custom verification email template.

Link to this function

delete_identity(identity)

View Source

Specs

delete_identity(binary()) :: ExAws.Operation.Query.t()

Deletes the specified identity (an email address or a domain) from the list of verified identities.

Link to this function

delete_suppressed_destination(email_address)

View Source

Specs

delete_suppressed_destination(String.t()) :: ExAws.Operation.JSON.t()

Delete an email address from list of suppressed destinations.

Link to this function

delete_template(template_name)

View Source

Specs

delete_template(binary()) :: ExAws.Operation.Query.t()

Deletes an email template.

Link to this function

get_contact(list_name, email)

View Source

Specs

Show a contact in a contact list.

Link to this function

get_contact_list(list_name)

View Source

Specs

get_contact_list(String.t()) :: ExAws.Operation.JSON.t()

Show contact list.

Link to this function

get_identity_verification_attributes(identities)

View Source

Specs

get_identity_verification_attributes([binary()]) :: ExAws.Operation.Query.t()

Fetch identities verification status and token (for domains).

Link to this function

get_template(template_name)

View Source

Specs

get_template(String.t()) :: ExAws.Operation.Query.t()

Get email template

Link to this function

list_configuration_sets(opts \\ [])

View Source

Specs

list_configuration_sets(opts :: [] | [list_configuration_sets_opt()]) ::
  ExAws.Operation.Query.t()

Fetch configuration sets associated with AWS account.

Specs

list_contact_lists() :: ExAws.Operation.JSON.t()

List contact lists.

The API accepts pagination parameters, but they're redundant as AWS limits usage to a single list per account.

Link to this function

list_contacts(list_name)

View Source

Specs

list_contacts(String.t()) :: ExAws.Operation.JSON.t()

Show contacts in contact list.

Link to this function

list_custom_verification_email_templates(opts \\ [])

View Source

Specs

list_custom_verification_email_templates(
  opts :: [list_custom_verification_email_templates_opt()] | []
) :: ExAws.Operation.Query.t()

Lists custom verification email templates.

Link to this function

list_identities(opts \\ [])

View Source

Specs

list_identities(opts :: [] | [list_identities_opt()]) ::
  ExAws.Operation.Query.t()

List identities associated with the AWS account

Link to this function

list_templates(opts \\ [])

View Source

Specs

list_templates(opts :: [] | [list_templates_opt()]) :: ExAws.Operation.Query.t()

List email templates.

Link to this function

put_suppressed_destination(email_address, suppression_reason)

View Source

Specs

put_suppressed_destination(String.t(), SuppressionReason.t()) ::
  ExAws.Operation.JSON.t()

Add an email address to list of suppressed destinations. A suppression reason is mandatory (see t:suppression_reason()).

Link to this function

send_bulk_templated_email(template, source, destinations, opts \\ [])

View Source

Specs

send_bulk_templated_email(
  template :: binary(),
  source :: binary(),
  destinations :: bulk_destination(),
  opts :: [send_bulk_templated_email_opt()]
) :: ExAws.Operation.Query.t()

Send a templated email to multiple destinations.

Link to this function

send_custom_verification_email(email_address, template_name, opts \\ [])

View Source

Specs

send_custom_verification_email(
  String.t(),
  String.t(),
  opts :: [send_custom_verification_email_opt()] | []
) :: ExAws.Operation.Query.t()

Send a verification email using a custom template.

Link to this function

send_email(dst, msg, src, opts \\ [])

View Source

Specs

send_email(
  dst :: destination(),
  msg :: message(),
  src :: binary(),
  opts :: [send_email_opt()]
) ::
  ExAws.Operation.Query.t()

Composes an email message.

Link to this function

send_email_v2(destination, content, from_email, opts \\ [])

View Source

Send an email via the SES V2 API, which supports list management.

:content should include one of a Raw, Simple, or Template key.

Link to this function

send_raw_email(raw_msg, opts \\ [])

View Source

Specs

send_raw_email(binary(), opts :: [send_raw_email_opt()]) ::
  ExAws.Operation.Query.t()

Send a raw Email.

Link to this function

send_templated_email(dst, src, template, template_data, opts \\ [])

View Source

Specs

send_templated_email(
  dst :: destination(),
  src :: binary(),
  template :: binary(),
  template_data :: binary(),
  opts :: [send_templated_email_opt()]
) :: ExAws.Operation.Query.t()

Send a templated Email.

Link to this function

set_identity_feedback_forwarding_enabled(enabled, identity)

View Source

Specs

set_identity_feedback_forwarding_enabled(boolean(), binary()) ::
  ExAws.Operation.Query.t()

Enables or disables whether Amazon SES forwards notifications as email.

Link to this function

set_identity_headers_in_notifications_enabled(identity, type, enabled)

View Source

Specs

set_identity_headers_in_notifications_enabled(
  binary(),
  notification_type(),
  boolean()
) ::
  ExAws.Operation.Query.t()

Set whether SNS notifications should include original email headers or not.

Link to this function

set_identity_notification_topic(identity, type, opts \\ [])

View Source

Specs

set_identity_notification_topic(
  binary(),
  notification_type(),
  set_identity_notification_topic_opt() | []
) :: ExAws.Operation.Query.t()

Sets the Amazon Simple Notification Service (Amazon SNS) topic to which Amazon SES will publish delivery notifications for emails sent with given identity.

Absent :sns_topic options cleans SnsTopic and disables publishing.

Notification type can be on of the :bounce, :complaint, or :delivery. Requests are throttled to one per second.

Link to this function

update_contact(list_name, email, opts \\ [])

View Source

Specs

update_contact(String.t(), email_address(), [contact_opt()]) ::
  ExAws.Operation.JSON.t()

Update a contact in a contact list.

Link to this function

update_contact_list(list_name, opts \\ [])

View Source

Specs

update_contact_list(String.t(), opts :: [update_contact_list_opt()]) ::
  ExAws.Operation.JSON.t()

Update a contact list. Only accepts description and topic updates.

examples

Examples

ExAws.SES.update_contact_list("test_list", description: "New description")
Link to this function

update_custom_verification_email_template(opts \\ [])

View Source

Specs

update_custom_verification_email_template(
  opts :: [update_custom_verification_email_template_opt()] | []
) :: ExAws.Operation.Query.t()

Update or create a custom verification email template.

Link to this function

update_template(template_name, subject, html, text, opts \\ [])

View Source

Specs

update_template(
  String.t(),
  String.t(),
  String.t(),
  String.t(),
  opts :: [update_template_opt()]
) ::
  ExAws.Operation.Query.t()

Updates an email template.

Link to this function

verify_email_identity(email)

View Source

Specs

verify_email_identity(email :: binary()) :: ExAws.Operation.Query.t()

Verifies an email address.