()
| 156 | |
| 157 | # snippet-start:[python.example_code.ses.Scenario_EmailIdentity] |
| 158 | def usage_demo(): |
| 159 | print("-" * 88) |
| 160 | print("Welcome to the Amazon Simple Email Service (Amazon SES) identities demo!") |
| 161 | print("-" * 88) |
| 162 | |
| 163 | logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") |
| 164 | |
| 165 | ses_identity = SesIdentity(boto3.client("ses")) |
| 166 | email = input( |
| 167 | "Enter an email address to verify with Amazon SES. This address will " |
| 168 | "receive a verification email: " |
| 169 | ) |
| 170 | ses_identity.verify_email_identity(email) |
| 171 | |
| 172 | print(f"Follow the steps in the email to {email} to complete verification.") |
| 173 | print("Waiting for verification...") |
| 174 | try: |
| 175 | ses_identity.wait_until_identity_exists(email) |
| 176 | print(f"Identity verified for {email}.") |
| 177 | except WaiterError: |
| 178 | print( |
| 179 | f"Verification timeout exceeded. You must complete the " |
| 180 | f"steps in the email sent to {email} to verify the address." |
| 181 | ) |
| 182 | |
| 183 | identities = ses_identity.list_identities("EmailAddress", 10) |
| 184 | print("The identities in the account are:") |
| 185 | print(*identities, sep="\n") |
| 186 | |
| 187 | status = ses_identity.get_identity_status(email) |
| 188 | print(f"{email} has status: {status}.") |
| 189 | |
| 190 | answer = input(f"Do you want to remove {email} from Amazon SES (y/n)? ") |
| 191 | if answer.lower() == "y": |
| 192 | ses_identity.delete_identity(email) |
| 193 | print(f"{email} removed from Amazon SES.") |
| 194 | |
| 195 | print("Thanks for watching!") |
| 196 | print("-" * 88) |
| 197 | |
| 198 | |
| 199 | # snippet-end:[python.example_code.ses.Scenario_EmailIdentity] |
no test coverage detected