Authors: Ransom Richardson (ransom@ransomr.net), Nicholas Lundgaard (nalundgaard@gmail.com).
An Erlang interface to Amazon's Simple Email Service (SES)
Methods not implemented: * DeleteIdentityPolicy * DeleteVerifiedEmailAddress (deprecated; use DeleteIdentity) * GetIdentityPolicies * ListIdentityPolicies * ListVerifiedEmailAddresses (deprecated; use ListIdentities) * PutIdentityPolicy * VerifyEmailAddress (deprecated; use VerifyEmailIdentity)create_custom_verification_email_template_result() = ok | {error, term()}
custom_template_attribute_names() = template_name | from_email_address | template_subject | template_content | success_redirect_url | failure_redirect_url
custom_template_attributes() = [{custom_template_attribute_names(), string()}]
delete_custom_verification_email_template_result() = ok | {error, term()}
delete_identity_result() = ok | {error, term()}
dkim_attributes() = [{email(), [{dkim_enabled, boolean()} | {dkim_verification_status, verification_status()} | {dkim_tokens, [string()]}]}]
domain() = string() | binary()
email() = string() | binary()
emails() = email() | [email()]
get_custom_verification_email_template_result() = {ok, custom_template_attributes()} | {error, term()}
get_identity_dkim_attributes_result() = {ok, [{dkim_attributes, dkim_attributes()}]} | {error, term()}
get_identity_notification_attributes_result() = {ok, [{notification_attributes, notification_attributes()}]} | {error, term()}
get_identity_verification_attributes_result() = {ok, [{verification_attributes, verification_attributes()}]} | {error, term()}
get_send_quota_result() = {ok, [{sent_last_24_hours, float()} | {max_24_hour_send, float()} | {max_send_rate, float()}]} | {error, term()}
get_send_statistics_result() = {ok, [{send_data_points, send_data_point()}]} | {error, term()}
identities() = identity() | [identity()]
identity() = string() | binary()
identity_type() = email_address | domain
list_custom_verification_email_templates_result() = {ok, [{custom_templates, [custom_template_attributes()]}]} | {error, term()}
list_identities_opt() = {identity_type, identity_type()} | {max_items, pos_integer()} | {next_token, string() | binary()}
list_identities_opts() = [list_identities_opt()]
list_identities_result() = {ok, [{identities, [string()]} | {next_token, string()}]} | {error, term()}
notification_attributes() = [{email(), [{forwarding_enabled, boolean()} | {bounce_topic, string()} | {complaint_topic, string()} | {delivery_topic, string()}]}]
notification_type() = bounce | complaint | delivery
send_custom_verification_email_result() = {ok, term()} | {error, term()}
send_data_point() = [{delivery_attempts, integer()} | {timestamp, string()} | {rejects, integer()} | {bounces, integer()} | {complaints, integer()}]
send_email_body() = string() | binary() | [{Type::text | html, send_email_content()}]
send_email_content() = string() | binary() | [{Type::data | charset, string() | binary()}]
send_email_destination() = email() | [send_email_destination_pair()]
send_email_destination_pair() = {to_addresses, emails()} | {cc_addresses, emails()} | {bcc_addresses, emails()}
send_email_opt() = {configuration_set_name, string() | binary()} | {reply_to_addresses, emails()} | {return_path, email()} | {tags, [{string() | binary(), string() | binary()}]}
send_email_opts() = [send_email_opt()]
send_email_result() = {ok, [{message_id, string()}]} | {error, term()}
send_email_source() = email()
send_email_subject() = send_email_content()
send_raw_email_message() = binary() | string()
send_raw_email_opt() = {source, email()} | {destinations, emails()}
send_raw_email_opts() = [send_raw_email_opt()]
send_raw_email_result() = {ok, [{message_id, string()}]} | {error, term()}
set_identity_dkim_enabled_result() = ok | {error, term()}
set_identity_feedback_forwarding_enabled_result() = ok | {error, term()}
set_identity_notification_topic_result() = ok | {error, term()}
sns_topic() = string() | binary()
update_custom_verification_email_template_result() = ok | {error, term()}
verification_attributes() = [{email(), [{verification_status, verification_status()} | {verification_token, string()}]}]
verification_status() = pending | success | failed | temporary_failure | not_started
verify_domain_dkim_result() = {ok, [{dkim_tokens, [string()]}]} | {error, term()}
verify_domain_identity_result() = {ok, [{verification_token, string()}]} | {error, term()}
verify_email_identity_result() = ok | {error, term()}
configure(AccessKeyID::string(), SecretAccessKey::string()) -> ok
configure(AccessKeyID::string(), SecretAccessKey::string(), Host::string()) -> ok
create_custom_verification_email_template(TemplateName::string(), FromEmailAddress::string(), TemplateSubject::string(), TemplateContent::string(), SuccessRedirectionURL::string(), FailureRedirectionURL::string()) -> create_custom_verification_email_template_result()
SES API: https://docs.aws.amazon.com/ses/latest/APIReference/API_CreateCustomVerificationEmailTemplate.html
Creates a new custom verification email template.
ok = erlcloud_ses:create_custom_verification_email_template_result(
"templaneName",
"support@example.com",
"Welcome to support",
"limited html content",
"https://www.example.com/success",
"https://www.example.com/failure" ).
create_custom_verification_email_template(TemplateName::string(), FromEmailAddress::string(), TemplateSubject::string(), TemplateContent::string(), SuccessRedirectionURL::string(), FailureRedirectionURL::string(), Config::aws_config()) -> create_custom_verification_email_template_result()
delete_custom_verification_email_template(TemplateName::string()) -> delete_custom_verification_email_template_result()
SES API: https://docs.aws.amazon.com/ses/latest/APIReference/API_DeleteCustomVerificationEmailTemplate.html
Deletes an existing custom verification email template.
ok = erlcloud_ses:delete_custom_verification_email_template("templaneName").
delete_custom_verification_email_template(TemplateName::string(), Config::aws_config()) -> delete_custom_verification_email_template_result()
delete_identity(Identity) -> any()
delete_identity(Identity::identity(), Config::aws_config()) -> delete_identity_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_DeleteIdentity.html
Delete an identity.
ok = erlcloud_ses:delete_identity(<<"user@example.com">>).
get_custom_verification_email_template(TemplateName::string()) -> get_custom_verification_email_template_result()
SES API: https://docs.aws.amazon.com/ses/latest/APIReference/API_GetCustomVerificationEmailTemplate.html
Returns the custom email verification template for the template name you specify.
{ok,[{template_name,"templateName"},
{from_email_address,"support@example.com"},
{template_subject,"Welcome to Example.com"},
{template_content,"<html>\n<head></head>\n <body style=\"font-family:sans-serif;\">\n<h1 style=
\"text-align:center\">Ready to start with Example.com</h1>\n<p>Example.com is very happy to
welcome you to the ACME system Please click\non the link below to activate
your account.</p>\n</body>\n</html>"},
{success_redirect_url,"https://www.example.com/success"},
{failure_redirect_url,"http://example.arilia.com"}]} =
erlcloud_ses:delete_custom_verification_email_template("templaneName").
get_custom_verification_email_template(TemplateName::string(), Config::aws_config()) -> get_custom_verification_email_template_result()
get_identity_dkim_attributes(Identities) -> any()
get_identity_dkim_attributes(Identities::identities(), Config::aws_config()) -> get_identity_dkim_attributes_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_GetIdentityDkimAttributes.html
Get DKIM attributes for an identity.
{ok, [{dkim_attributes, [{"amazon.com",
[{dkim_enabled, true},
{dkim_verification_status, success},
{dkim_tokens,["vvjuipp74whm76gqoni7qmwwn4w4qusjiainivf6f",
"3frqe7jn4obpuxjpwpolz6ipb3k5nvt2nhjpik2oy",
"wrqplteh7oodxnad7hsl4mixg2uavzneazxv5sxi2"]}]}]}]} =
erlcloud_ses:get_identity_dkim_attributes(["amazon.com"]).
get_identity_notification_attributes(Identities) -> any()
get_identity_notification_attributes(Identities::identities(), Config::aws_config()) -> get_identity_notification_attributes_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_GetIdentityNotificationAttributes.html
Get notification attributes for an identity.
{ok, [{notification_attributes, [{"user@example.com",
[{forwarding_enabled, true},
{bounce_topic, "arn:aws:sns:us-east-1:123456789012:example"},
{complaint_topic, "arn:aws:sns:us-east-1:123456789012:example"},
{delivery_topic, "arn:aws:sns:us-east-1:123456789012:example"}]}]}]} =
erlcloud_ses:get_identity_notification_attributes(["user@example.com"]).
get_identity_verification_attributes(Identities) -> any()
get_identity_verification_attributes(Identities::identities(), Config::aws_config()) -> get_identity_verification_attributes_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_GetIdentityVerificationAttributes.html
Get verification attributes for an identity.
{ok, [{verification_attributes, [{"domain.com",
[{verification_status, pending},
{verification_token, "QTKknzFg2J4ygwa+XvHAxUl1hyHoY0gVfZdfjIedHZ0="}]},
{"user@domain.com",
[{verification_status, pending}]}]}]} =
erlcloud_ses:get_identity_verification_attributes(["user@domain.com", "domain.com"]).
get_send_quota() -> any()
get_send_quota(Config::aws_config()) -> get_send_quota_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_GetSendQuota.html
Get the send quota.
{ok, [{sent_last_24_hours, 127.0},
{max_24_hour_send, 200.0},
{max_send_rate, 1.0}]} =
erlcloud_ses:get_send_quota().
get_send_statistics() -> any()
get_send_statistics(Config::aws_config()) -> get_send_statistics_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_GetSendStatistics.html
Get send statistics.
{ok,[{send_data_points, [[{delivery_attempts,7},
{timestamp,"2011-08-03T06:53:00Z"},
{rejects,0},
{bounces,0},
{complaints,0}],
...
]}]} =
erlcloud_ses:get_send_statistics().
list_custom_verification_email_templates() -> list_custom_verification_email_templates_result()
SES API: https://docs.aws.amazon.com/ses/latest/APIReference/API_ListCustomVerificationEmailTemplates.html
Lists the existing custom verification email templates for your account in the current AWS Region.
{ok,[{custom_templates,[[{template_name,"template1"},
{from_email_address,"support@example.com"},
{template_subject,"Welcome to support"},
{success_redirect_url,"https://www.example.com/success"},
{failure_redirect_url,"https://www.example.com/failure"}],
[{template_name,"template2"},
{from_email_address,"applications@example.com"},
{template_subject,"Welcome to Applications"},
{success_redirect_url,"https://www.example.com/success"},
{failure_redirect_url,"https://www.example.com/failure"}]]}]} =
erlcloud_ses:list_custom_verification_email_templates().
list_custom_verification_email_templates(Config::aws_config()) -> list_custom_verification_email_templates_result()
list_identities() -> any()
list_identities(Aws_config) -> any()
list_identities(Opts::list_identities_opts(), Config::aws_config()) -> list_identities_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_ListIdentities.html
List identities.
{ok, [{identities, ["example.com", "user@example.com"]}]} =
erlcloud_ses:list_identities().
All supported inputs.
{ok, [{identities, ["example.com"]},
{next_token, "..."}]} =
erlcloud_ses:list_identities([{identity_type, domain},
{max_items, 1},
{next_token, "..."}]).
new(AccessKeyID::string(), SecretAccessKey::string()) -> aws_config()
new(AccessKeyID::string(), SecretAccessKey::string(), Host::string()) -> aws_config()
send_custom_verification_email(EmailAddress::string(), TemplateName::string()) -> send_custom_verification_email_result()
SES API: https://docs.aws.amazon.com/ses/latest/APIReference/API_SendCustomVerificationEmail.html
Send a custom verification email.
{ok, [{message_id, "abcdefghijkllkjdlkj"}]} =
erlcloud_ses:send_custom_verification_email_result("newclient@newco.com", "templateName").
send_custom_verification_email(EmailAddress::string(), TemplateName::string(), Config::aws_config()) -> send_custom_verification_email_result()
send_email(Destination, Body, Subject, Source) -> any()
send_email(Destination, Body, Subject, Source, Aws_config) -> any()
send_email(Destination::send_email_destination(), Body::send_email_body(), Subject::send_email_subject(), Source::send_email_source(), Opts::send_email_opts(), Config::aws_config()) -> send_email_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_SendEmail.html
Send a simple email.
{ok, [{message_id, "00000131d51d2292-159ad6eb-077c-46e6-ad09-ae7c05925ed4-000000"}]} =
erlcloud_ses:send_email(<<"a@to.com">>, <<"Email Body">>, <<"Subject">>,
<<"b@from.com">>, []).
All supported inputs.
{ok, [{message_id, "00000131d51d2292-159ad6eb-077c-46e6-ad09-ae7c05925ed4-000000"}]} =
erlcloud_ses:send_email([{bcc_addresses, [<<"a@bcc.com">>, "b@bcc.com"]},
{cc_addresses, [<<"c@cc.com">>]},
{to_addresses, ["d@to.com"]}],
[{html, [{charset, "html charset"},
{data, "html data"}]},
{text, [{charset, "text charset"},
{data, "text data"}]}],
[{charset, "subject charset"},
{data, "subject data"}],
"e@from.com",
[{reply_to_addresses, [<<"f@reply.com">>, "g@reply.com"]},
{return_path, "return path"}]).
send_raw_email(RawMessage) -> any()
send_raw_email(RawMessage, Aws_config) -> any()
send_raw_email(RawMessage::send_raw_email_message(), Opts::send_raw_email_opts(), Config::aws_config()) -> send_raw_email_result()
SES API: https://docs.aws.amazon.com/ses/latest/APIReference/API_SendRawEmail.html
Send a raw email.
{ok, [{message_id, "00000131d51d2292-159ad6eb-077c-46e6-ad09-ae7c05925ed4-000000"}]} =
erlcloud_ses:send_raw_email(<<"From: b@from.com\nTo: a@to.com\nSubject: Subject\nMIME-Version: 1.0\nContent-type: Multipart/Mixed; boundary=\"NextPart\"\n\n--NextPart\nContent-Type: text/plain\n\nEmail Body\n\n--NextPart--">>, []).
All supported inputs.
{ok, [{message_id, "00000131d51d2292-159ad6eb-077c-46e6-ad09-ae7c05925ed4-000000"}]} =
erlcloud_ses:send_email(<<"To: d@to.com\nCC: c@cc.com\nBCC: a@bcc.com, b@bcc.com\nSubject: Subject\nMIME-Version: 1.0\nContent-type: Multipart/Mixed; boundary=\"NextPart\"\n\n--NextPart\nContent-Type: text/plain\n\nEmail Body\n\n--NextPart--">>,
[{destinations, [<<"a@bcc.com">>, "b@bcc.com", <<"c@cc.com">>, "d@to.com"]},
{source, "e@from.com"}].
set_identity_dkim_enabled(Identity, DkimEnabled) -> any()
set_identity_dkim_enabled(Identity::identity(), DkimEnabled::boolean(), Config::aws_config()) -> set_identity_dkim_enabled_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_SetIdentityDkimEnabled.html
Enable DKIM for an identity.
ok = erlcloud_ses:set_identity_dkim_enabled(<<"user@example.com">>, true).
set_identity_feedback_forwarding_enabled(Identity, ForwardingEnabled) -> any()
set_identity_feedback_forwarding_enabled(Identity::identity(), ForwardingEnabled::boolean(), Config::aws_config()) -> set_identity_feedback_forwarding_enabled_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_SetIdentityFeedbackForwardingEnabled.html
Enable feedback forwarding for an identity.
ok = erlcloud_ses:set_identity_feedback_forwarding_enabled(<<"user@example.com">>, true).
set_identity_notification_topic(Identity, NotificationType, SnsTopic) -> any()
set_identity_notification_topic(Identity::identity(), NotificationType::notification_type(), SnsTopic::sns_topic(), Config::aws_config()) -> set_identity_notification_topic_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_SetIdentityFeedbackForwardingEnabled.html
Set the bounce notification topic for an identity.
ok = erlcloud_ses:set_identity_notification_topic(<<"user@example.com">>,
bounce,
<<"arn:aws:sns:us-east-1:123456789012:example">>).
update_custom_verification_email_template(TemplateName::string(), Attributes::[{atom(), string()}]) -> update_custom_verification_email_template_result()
SES API: https://docs.aws.amazon.com/ses/latest/APIReference/API_UpdateCustomVerificationEmailTemplate.html
Template attributes { template_name , string() } { from_email_address , string() } { template_subject , string() } { template_content , string() } { success_redirect_url , string() } { failure_redirect_url , string() }
Updates an existing custom verification email template.
ok = erlcloud_ses:update_custom_verification_email_template("templateName",
[{template_subject, "New subject"},
{from_email_address, "support2@example.com"}]).
Please consult the following for what is and not allowed in the HTML content parameter
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/custom-verification-emails.html#custom-verification-emails-faq
update_custom_verification_email_template(TemplateName::string(), Attributes::[{atom(), string()}], Config::aws_config()) -> update_custom_verification_email_template_result()
verify_domain_dkim(Domain) -> any()
verify_domain_dkim(Domain::domain(), Config::aws_config()) -> verify_domain_dkim_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_VerifyDomainIdentity.html
Get DKIM tokens for a domain.
{ok, [{dkim_tokens, ["vvjuipp74whm76gqoni7qmwwn4w4qusjiainivf6sf",
"3frqe7jn4obpuxjpwpolz6ipb3k5nvt2nhjpik2oy",
"wrqplteh7oodxnad7hsl4mixg2uavzneazxv5sxi2"]}]} =
erlcloud_ses:verify_domain_dkim(<<"example.com">>).
verify_domain_identity(Domain) -> any()
verify_domain_identity(Domain::domain(), Config::aws_config()) -> verify_domain_identity_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_VerifyDomainIdentity.html
Verify a domain.
{ok, [{verification_token, "QTKknzFg2J4ygwa+XvHAxUl1hyHoY0gVfZdfjIedHZ0="}] =
erlcloud_ses:verify_domain_identity(<<"example.com">>).
verify_email_identity(EmailAddress) -> any()
verify_email_identity(EmailAddress::email(), Config::aws_config()) -> verify_email_identity_result()
SES API: http://docs.aws.amazon.com/ses/2010-12-01/APIReference/API_VerifyEmailIdentity.html
Verify an email address.
ok = erlcloud_ses:verify_email_identity(<<"user@example.com">>).
Generated by EDoc