文档 AWS SDK 示例 GitHub 存储库中还有更多 S AWS DK 示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
你好 Amazon SES API v2
以下代码示例展示了如何开始使用 Amazon SES API v2。
- Python
-
- 适用于 Python 的 SDK(Boto3)
-
注意
还有更多相关信息 GitHub。在 AWS 代码示例存储库
中查找完整示例,了解如何进行设置和运行。 def hello_sesv2(sesv2_client): """ Use the AWS SDK for Python (Boto3) to create an Amazon SESv2 client and list the email identities in your account. This example uses the default settings specified in your shared credentials and config files. :param sesv2_client: A Boto3 SESv2 client object. """ print("Hello, Amazon SESv2. Let's list up to 5 email identities:\n") try: response = sesv2_client.list_email_identities(PageSize=5) identities = response["EmailIdentities"] if not identities: print( "No email identities found. " "Use CreateEmailIdentity to add one." ) else: for identity in identities: print( f" Identity: {identity['IdentityName']}" f" Type: {identity['IdentityType']}" f" Status: {identity['VerificationStatus']}" f" Sending: {'Enabled' if identity['SendingEnabled'] else 'Disabled'}" ) print(f"\nShowing {len(identities)} email identity(ies).") except ClientError as err: logger.error( "Couldn't list email identities. Here's why: %s: %s", err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise-
有关 API 的详细信息,请参阅适用ListEmailIdentities于 Python 的AWS SDK (Boto3) API 参考。
-
基本功能
操作