ses_send_verification.rb - AWS Code Sample


Verifies an email address for SES.

# Copyright 2010-2019, Inc. or its affiliates. All Rights Reserved. # # This file is licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. A copy of the # License is located at # # # # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS # OF ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. require 'aws-sdk-ses' # v2: require 'aws-sdk' # Replace with a "To" address. recipient = "" # Create a new SES resource in the us-west-2 region. # Replace us-west-2 with the AWS Region you're using for Amazon SES. ses = 'us-west-2') # Try to verify email address. begin ses.verify_email_identity({ email_address: recipient }) puts 'Email sent to ' + recipient # If something goes wrong, display an error message. rescue Aws::SES::Errors::ServiceError => error puts "Email not sent. Error message: #{error}" end

Sample Details

Service: ses

Last tested: 2018-03-16

Author: Doug-AWS

Type: full-example