Sample code for 30+ languages & platforms
DataFlex

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 DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    String sRegion
    Handle hoHost
    Variant vSigner
    Handle hoSigner
    Variant vConnection
    Handle hoConnection
    Handle hoRest
    String sSessionToken
    String sResponseText
    Handle hoResult
    String sStatus
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

    Move False To iSuccess

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

    Move False To iSuccess

    //  Use the same AWS Region for the identity, endpoint, and Signature Version 4.
    Move "us-west-2" To sRegion
    Get Create (RefClass(cComChilkatStringBuilder)) To hoHost
    If (Not(IsComObjectCreated(hoHost))) Begin
        Send CreateComObject of hoHost
    End
    Get ComAppend Of hoHost "email." To iSuccess
    Get ComAppend Of hoHost sRegion To iSuccess
    Get ComAppend Of hoHost ".amazonaws.com" To iSuccess

    Get Create (RefClass(cComChilkatAuthAws)) To hoSigner
    If (Not(IsComObjectCreated(hoSigner))) Begin
        Send CreateComObject of hoSigner
    End
    //  Supply the credentials from your application's credential provider.
    Set ComAccessKey Of hoSigner To "AWS_ACCESS_KEY_ID"
    Set ComSecretKey Of hoSigner To "AWS_SECRET_ACCESS_KEY"
    Set ComRegion Of hoSigner To sRegion
    Set ComServiceName Of hoSigner To "ses"

    Get Create (RefClass(cComChilkatSocket)) To hoConnection
    If (Not(IsComObjectCreated(hoConnection))) Begin
        Send CreateComObject of hoConnection
    End
    Set ComRequireSslCertVerify Of hoConnection To True
    Get ComGetAsString Of hoHost To sTemp1
    Get ComConnect Of hoConnection sTemp1 443 True 10000 To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoConnection To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatRest)) To hoRest
    If (Not(IsComObjectCreated(hoRest))) Begin
        Send CreateComObject of hoRest
    End
    Get pvComObject of hoConnection to vConnection
    Get ComUseConnection Of hoRest vConnection False To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get pvComObject of hoSigner to vSigner
    Get ComSetAuthAws Of hoRest vSigner To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    //  For temporary AWS credentials, supply the session token from the same provider.
    Move "" To sSessionToken
    If (sSessionToken <> "") Begin
        Get ComAddQueryParam Of hoRest "X-Amz-Security-Token" sSessionToken To iSuccess
    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.
    Get ComAddQueryParam Of hoRest "Action" "GetIdentityVerificationAttributes" To iSuccess
    Get ComAddQueryParam Of hoRest "Version" "2010-12-01" To iSuccess
    Get ComAddQueryParam Of hoRest "Identities.member.1" "sender+reports@example.com" To iSuccess
    Get ComFullRequestNoBody Of hoRest "GET" "/" To sResponseText
    Get ComLastMethodSuccess Of hoRest To bTemp1
    If (bTemp1 <> True) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComResponseStatusCode Of hoRest To iTemp1
    If (iTemp1 <> 200) Begin
        Get ComResponseStatusCode Of hoRest To iTemp1
        Showln "SES returned HTTP " iTemp1 " " sResponseText
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatXml)) To hoResult
    If (Not(IsComObjectCreated(hoResult))) Begin
        Send CreateComObject of hoResult
    End
    Get ComLoadXml Of hoResult sResponseText To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoResult To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    //  A map entry contains the identity as key and its verification attributes as value.
    Get ComNumChildrenAt Of hoResult "GetIdentityVerificationAttributesResult|VerificationAttributes" To iTemp1
    If (iTemp1 < 1) Begin
        Showln "No verification entry returned for this address in this Region."
        Procedure_Return
    End

    Get ComGetChildContent Of hoResult "GetIdentityVerificationAttributesResult|VerificationAttributes|entry|value|VerificationStatus" To sStatus
    Showln "Verification status: " sStatus
    If (sStatus = "Pending") Begin
        Showln "Open the AWS verification email and follow its link."
    End



End_Procedure