Menu
AWS SDK for Go
Developer Guide

Listing Valid Amazon SES Email Addresses

The following example demonstrates how to use the AWS SDK for Go to list the valid Amazon SES email addresses.

Copy
package main import ( "fmt" "os" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ses" ) func main() { // Initialize a session in us-west-2 that the SDK will use to load // credentials from the shared credentials file ~/.aws/credentials. sess, err := session.NewSession(&aws.Config{ Region: aws.String("us-west-2")}, ) // Create SES service client svc := ses.New(sess) result, err := svc.ListIdentities(&ses.ListIdentitiesInput{IdentityType: aws.String("EmailAddress")}) if err != nil { fmt.Println(err) os.Exit(1) } for _, email := range result.Identities { var e = []*string{email} verified, err := svc.GetIdentityVerificationAttributes(&ses.GetIdentityVerificationAttributesInput{Identities: e}) if err != nil { fmt.Println(err) os.Exit(1) } for _, va := range verified.VerificationAttributes { if *va.VerificationStatus == "Success" { fmt.Println(*email) } } } }

See the complete example on GitHub.