Visual FoxPro
Visual FoxPro
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 Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL lcRegion
LOCAL loHost
LOCAL loSigner
LOCAL loConnection
LOCAL loRest
LOCAL lcSessionToken
LOCAL lcResponseText
LOCAL loResult
LOCAL lcStatus
lnSuccess = 0
* Assumes Chilkat is unlocked. See Global Unlock Sample.
lnSuccess = 0
* Use the same AWS Region for the identity, endpoint, and Signature Version 4.
lcRegion = "us-west-2"
loHost = CreateObject('Chilkat.StringBuilder')
loHost.Append("email.")
loHost.Append(lcRegion)
loHost.Append(".amazonaws.com")
loSigner = CreateObject('Chilkat.AuthAws')
* Supply the credentials from your application's credential provider.
loSigner.AccessKey = "AWS_ACCESS_KEY_ID"
loSigner.SecretKey = "AWS_SECRET_ACCESS_KEY"
loSigner.Region = lcRegion
loSigner.ServiceName = "ses"
loConnection = CreateObject('Chilkat.Socket')
loConnection.RequireSslCertVerify = 1
lnSuccess = loConnection.Connect(loHost.GetAsString(),443,1,10000)
IF (lnSuccess <> 1) THEN
? loConnection.LastErrorText
RELEASE loHost
RELEASE loSigner
RELEASE loConnection
CANCEL
ENDIF
loRest = CreateObject('Chilkat.Rest')
lnSuccess = loRest.UseConnection(loConnection,0)
IF (lnSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loHost
RELEASE loSigner
RELEASE loConnection
RELEASE loRest
CANCEL
ENDIF
lnSuccess = loRest.SetAuthAws(loSigner)
IF (lnSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loHost
RELEASE loSigner
RELEASE loConnection
RELEASE loRest
CANCEL
ENDIF
* For temporary AWS credentials, supply the session token from the same provider.
lcSessionToken = ""
IF (lcSessionToken <> "") THEN
loRest.AddQueryParam("X-Amz-Security-Token",lcSessionToken)
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.
loRest.AddQueryParam("Action","GetIdentityVerificationAttributes")
loRest.AddQueryParam("Version","2010-12-01")
loRest.AddQueryParam("Identities.member.1","sender+reports@example.com")
lcResponseText = loRest.FullRequestNoBody("GET","/")
IF (loRest.LastMethodSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loHost
RELEASE loSigner
RELEASE loConnection
RELEASE loRest
CANCEL
ENDIF
IF (loRest.ResponseStatusCode <> 200) THEN
? "SES returned HTTP " + STR(loRest.ResponseStatusCode) + " " + lcResponseText
RELEASE loHost
RELEASE loSigner
RELEASE loConnection
RELEASE loRest
CANCEL
ENDIF
loResult = CreateObject('Chilkat.Xml')
lnSuccess = loResult.LoadXml(lcResponseText)
IF (lnSuccess <> 1) THEN
? loResult.LastErrorText
RELEASE loHost
RELEASE loSigner
RELEASE loConnection
RELEASE loRest
RELEASE loResult
CANCEL
ENDIF
* A map entry contains the identity as key and its verification attributes as value.
IF (loResult.NumChildrenAt("GetIdentityVerificationAttributesResult|VerificationAttributes") < 1) THEN
? "No verification entry returned for this address in this Region."
RELEASE loHost
RELEASE loSigner
RELEASE loConnection
RELEASE loRest
RELEASE loResult
CANCEL
ENDIF
lcStatus = loResult.GetChildContent("GetIdentityVerificationAttributesResult|VerificationAttributes|entry|value|VerificationStatus")
? "Verification status: " + lcStatus
IF (lcStatus = "Pending") THEN
? "Open the AWS verification email and follow its link."
ENDIF
RELEASE loHost
RELEASE loSigner
RELEASE loConnection
RELEASE loRest
RELEASE loResult