Listing Valid Amazon SES Email Addresses - AWS SDK for Ruby

Listing Valid Amazon SES Email Addresses

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

require 'aws-sdk-ses' # v2: require 'aws-sdk' # Create client in us-west-2 region client = 'us-west-2') # Get up to 1000 identities ids = client.list_identities({ identity_type: "EmailAddress" }) ids.identities.each do |email| attrs = client.get_identity_verification_attributes({ identities: [email] }) status = attrs.verification_attributes[email].verification_status # Display email addresses that have been verified if status == "Success" puts email end

See the complete example on GitHub.