Lua
Lua
Amazon SES: Check sender verification status
See more Amazon SES Examples
Check the email identity created in Request sender verification. This read-only SES Query API operation uses ses:GetIdentityVerificationAttributes. It can look up several email addresses or domains in one signed request. Pending means SES is waiting for confirmation. Success means SES verified the identity. An address can also inherit verification from its domain.
GetIdentityVerificationAttributes
Chilkat Lua Downloads
local chilkat = require("chilkat")
-- Assumes Chilkat is unlocked. See Global Unlock Sample.
local success = false
-- Use the same AWS Region for the identity, endpoint, and Signature Version 4.
local region = "us-west-2"
local host = chilkat.StringBuilder.new()
host:append("email.")
host:append(region)
host:append(".amazonaws.com")
local signer = chilkat.AuthAws.new()
-- Supply the credentials from your application's credential provider.
signer.access_key = "AWS_ACCESS_KEY_ID"
signer.secret_key = "AWS_SECRET_ACCESS_KEY"
signer.region = region
signer.service_name = "ses"
local connection = chilkat.Socket.new()
connection.require_ssl_cert_verify = true
success = connection:connect(host:get_as_string(), 443, true, 10000)
if not success then
print(connection.last_error_text)
return
end
local rest = chilkat.Rest.new()
success = rest:use_connection(connection, false)
if not success then
print(rest.last_error_text)
return
end
success = rest:set_auth_aws(signer)
if not success then
print(rest.last_error_text)
return
end
-- For temporary AWS credentials, supply the session token from the same provider.
local sessionToken = ""
if sessionToken ~= "" then
rest:add_query_param("X-Amz-Security-Token", sessionToken)
end
-- This read-only SES Query action accepts up to 100 addresses or domains.
-- Pass the original mailbox name. Chilkat encodes the plus sign when signing the query.
rest:add_query_param("Action", "GetIdentityVerificationAttributes")
rest:add_query_param("Version", "2010-12-01")
rest:add_query_param("Identities.member.1", "sender+reports@example.com")
local responseText = rest:full_request_no_body("GET", "/")
if not rest.last_method_success then
print(rest.last_error_text)
return
end
if rest.response_status_code ~= 200 then
print("SES returned HTTP " .. rest.response_status_code .. " " .. responseText)
return
end
local result = chilkat.Xml.new()
success = result:load_xml(responseText)
if not success then
print(result.last_error_text)
return
end
-- A map entry contains the identity as key and its verification attributes as value.
if result:num_children_at("GetIdentityVerificationAttributesResult|VerificationAttributes") < 1 then
print("No verification entry returned for this address in this Region.")
return
end
local status = result:get_child_content("GetIdentityVerificationAttributesResult|VerificationAttributes|entry|value|VerificationStatus")
print("Verification status: " .. status)
if status == "Pending" then
print("Open the AWS verification email and follow its link.")
end