View Source Swoosh.Adapters.ExAwsAmazonSES (Swoosh v1.17.2)
An adapter that wraps Swoosh.Adapters.AmazonSES
to use credentials from ExAws
.
You may prefer this adapter to Swoosh.Adapters.AmazonSES
if you have already
configured ExAws for your project and are using instance role credentials.
This allows you to use automatically managed, short-lived credentials, rather than provisioning a static access key / secret key pair.
See also:
IAM Roles for EC2 IAM roles for ECS tasks
Dependencies
In addition to the
:gen_smtp
dependency that theAmazonSES
adapter requires, this adapter also depends on:ex_aws
.Ensure you have the dependencies added in your mix.exs file:
def deps do [ {:swoosh, "~> 1.0"}, {:gen_smtp, "~> 1.0"}, {:ex_aws, "~> 2.1"}, # Dependency of `:ex_aws` {:sweet_xml, "~> 0.6"} ] end
Example
# config/config.exs
config :ex_aws,
access_key_id: [{:system, "AWS_ACCESS_KEY_ID"}, :instance_role],
secret_access_key: [{:system, "AWS_SECRET_ACCESS_KEY"}, :instance_role],
region: "us-east-1"
config :sample, Sample.Mailer,
adapter: Swoosh.Adapters.ExAwsAmazonSES
# lib/sample/mailer.ex
defmodule Sample.Mailer do
use Swoosh.Mailer, otp_app: :sample
end
See also:
Summary
Functions
Callback implementation for Swoosh.Adapter.deliver/2
.
Callback implementation for Swoosh.Adapter.validate_config/1
.
Callback implementation for Swoosh.Adapter.validate_dependency/0
.
Functions
Callback implementation for Swoosh.Adapter.deliver/2
.
Callback implementation for Swoosh.Adapter.validate_config/1
.
Callback implementation for Swoosh.Adapter.validate_dependency/0
.