Sample code for 30+ languages & platforms
Xbase++

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 Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL cRegion
LOCAL oHost
LOCAL oSigner
LOCAL oConnection
LOCAL oRest
LOCAL cSessionToken
LOCAL cResponseText
LOCAL oResult
LOCAL cStatus

nSuccess := 0

//  Assumes Chilkat is unlocked. See Global Unlock Sample.

nSuccess := 0

//  Use the same AWS Region for the identity, endpoint, and Signature Version 4.
cRegion := "us-west-2"
oHost := CreateObject("Chilkat.StringBuilder")
oHost:Append("email.")
oHost:Append(cRegion)
oHost:Append(".amazonaws.com")

oSigner := CreateObject("Chilkat.AuthAws")
//  Supply the credentials from your application's credential provider.
oSigner:AccessKey := "AWS_ACCESS_KEY_ID"
oSigner:SecretKey := "AWS_SECRET_ACCESS_KEY"
oSigner:Region := cRegion
oSigner:ServiceName := "ses"

oConnection := CreateObject("Chilkat.Socket")
oConnection:RequireSslCertVerify := 1
nSuccess := oConnection:Connect(oHost:GetAsString(), 443, 1, 10000)
IF (nSuccess != 1)
    ? oConnection:LastErrorText
    oHost:destroy()
    oSigner:destroy()
    oConnection:destroy()
    RETURN
ENDIF

oRest := CreateObject("Chilkat.Rest")
nSuccess := oRest:UseConnection(oConnection, 0)
IF (nSuccess != 1)
    ? oRest:LastErrorText
    oHost:destroy()
    oSigner:destroy()
    oConnection:destroy()
    oRest:destroy()
    RETURN
ENDIF

nSuccess := oRest:SetAuthAws(oSigner)
IF (nSuccess != 1)
    ? oRest:LastErrorText
    oHost:destroy()
    oSigner:destroy()
    oConnection:destroy()
    oRest:destroy()
    RETURN
ENDIF

//  For temporary AWS credentials, supply the session token from the same provider.
cSessionToken := ""
IF (cSessionToken != "")
    oRest:AddQueryParam("X-Amz-Security-Token", cSessionToken)
ENDIF

//  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.
oRest:AddQueryParam("Action", "GetIdentityVerificationAttributes")
oRest:AddQueryParam("Version", "2010-12-01")
oRest:AddQueryParam("Identities.member.1", "sender+reports@example.com")
cResponseText := oRest:FullRequestNoBody("GET", "/")
IF (oRest:LastMethodSuccess != 1)
    ? oRest:LastErrorText
    oHost:destroy()
    oSigner:destroy()
    oConnection:destroy()
    oRest:destroy()
    RETURN
ENDIF

IF (oRest:ResponseStatusCode != 200)
    ? "SES returned HTTP " + Str(oRest:ResponseStatusCode) + " " + cResponseText
    oHost:destroy()
    oSigner:destroy()
    oConnection:destroy()
    oRest:destroy()
    RETURN
ENDIF

oResult := CreateObject("Chilkat.Xml")
nSuccess := oResult:LoadXml(cResponseText)
IF (nSuccess != 1)
    ? oResult:LastErrorText
    oHost:destroy()
    oSigner:destroy()
    oConnection:destroy()
    oRest:destroy()
    oResult:destroy()
    RETURN
ENDIF

//  A map entry contains the identity as key and its verification attributes as value.
IF (oResult:NumChildrenAt("GetIdentityVerificationAttributesResult|VerificationAttributes") < 1)
    ? "No verification entry returned for this address in this Region."
    oHost:destroy()
    oSigner:destroy()
    oConnection:destroy()
    oRest:destroy()
    oResult:destroy()
    RETURN
ENDIF

cStatus := oResult:GetChildContent("GetIdentityVerificationAttributesResult|VerificationAttributes|entry|value|VerificationStatus")
? "Verification status: " + cStatus
IF (cStatus == "Pending")
    ? "Open the AWS verification email and follow its link."
ENDIF

oHost:destroy()
oSigner:destroy()
oConnection:destroy()
oRest:destroy()
oResult:destroy()