AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2026-05-01 · Documentation low

File: code-library/latest/ug/python_3_sesv2_code_examples.md

Summary

Added new 'Get started' section with ListEmailIdentities example, added GetEmailIdentity and SendBulkEmail examples, added comprehensive email attachments scenario, and updated GitHub repository links for multiple examples from generic sesv2 to specific scenario directories.

Security assessment

The changes are routine documentation updates adding new code examples and scenarios for Amazon SESv2. There is no evidence of addressing a specific security vulnerability or incident. The changes focus on functionality like listing email identities, sending bulk emails, and handling attachments. While some content mentions verification requirements and sandbox restrictions, these are standard AWS SES security practices, not new security features or fixes for vulnerabilities.

Diff

diff --git a/code-library/latest/ug/python_3_sesv2_code_examples.md b/code-library/latest/ug/python_3_sesv2_code_examples.md
index e7a5a8814..118ef3e12 100644
--- a//code-library/latest/ug/python_3_sesv2_code_examples.md
+++ b//code-library/latest/ug/python_3_sesv2_code_examples.md
@@ -7 +7 @@
-ActionsScenarios
+Get startedActionsScenarios
@@ -22,0 +23,2 @@ Each example includes a link to the complete source code, where you can find ins
+  * Get started
+
@@ -29,0 +32,58 @@ Each example includes a link to the complete source code, where you can find ins
+## Get started
+
+The following code example shows how to get started using Amazon SES API v2.
+
+**SDK for Python (Boto3)**
+    
+
+###### Note
+
+There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2/attachments_scenario#code-examples). 
+    
+    
+    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
+    
+    
+    
+    
+
+  * For API details, see [ListEmailIdentities](https://docs.aws.amazon.com/goto/boto3/sesv2-2019-09-27/ListEmailIdentities) in _AWS SDK for Python (Boto3) API Reference_. 
+
+
+
+
@@ -39 +99 @@ The following code example shows how to use `CreateContact`.
-There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2#code-examples). 
+There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2/newsletter_scenario#code-examples). 
@@ -118 +178 @@ The following code example shows how to use `CreateContactList`.
-There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2#code-examples). 
+There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2/newsletter_scenario#code-examples). 
@@ -173 +233 @@ The following code example shows how to use `CreateEmailIdentity`.
-There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2#code-examples). 
+There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2/newsletter_scenario#code-examples). 
@@ -228 +288 @@ The following code example shows how to use `CreateEmailTemplate`.
-There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2#code-examples). 
+There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2/newsletter_scenario#code-examples). 
@@ -290 +350 @@ The following code example shows how to use `DeleteContactList`.
-There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2#code-examples). 
+There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2/newsletter_scenario#code-examples). 
@@ -345 +405 @@ The following code example shows how to use `DeleteEmailIdentity`.
-There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2#code-examples). 
+There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2/newsletter_scenario#code-examples). 
@@ -400 +460 @@ The following code example shows how to use `DeleteEmailTemplate`.
-There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2#code-examples). 
+There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2/newsletter_scenario#code-examples). 
@@ -447,0 +508,68 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+The following code example shows how to use `GetEmailIdentity`.
+
+**SDK for Python (Boto3)**
+    
+
+###### Note
+
+There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2/attachments_scenario#code-examples). 
+    
+    
+    class SESv2Wrapper:
+        """Encapsulates Amazon SESv2 email sending actions."""
+    
+        def __init__(self, sesv2_client: Any) -> None:
+            """
+            Initializes the SESv2Wrapper with an SESv2 client.
+    
+            :param sesv2_client: A Boto3 SESv2 client.
+            """
+            self.sesv2_client = sesv2_client
+    
+        @classmethod
+        def from_client(cls) -> "SESv2Wrapper":
+            """
+            Creates an SESv2Wrapper instance with a default Boto3 SESv2 client.
+    
+            :return: A new SESv2Wrapper instance.
+            """
+            sesv2_client = boto3.client("sesv2")
+            return cls(sesv2_client)
+    
+    
+        def get_email_identity(self, email_address: str) -> Dict[str, Any]:
+            """
+            Gets information about an email identity, including its verification status.
+    
+            :param email_address: The email address or domain to look up.
+            :return: A dictionary with identity information including verification status.
+            :raises ClientError: If the identity is not found (NotFoundException).
+            """
+            try:
+                response = self.sesv2_client.get_email_identity(
+                    EmailIdentity=email_address
+                )
+                logger.info("Got email identity for %s.", email_address)
+                return response
+            except ClientError as err:
+                if err.response["Error"]["Code"] == "NotFoundException":
+                    logger.info(
+                        "Email identity %s not found.", email_address
+                    )
+                else:
+                    logger.error(
+                        "Couldn't get email identity %s. Here's why: %s: %s",
+                        email_address,
+                        err.response["Error"]["Code"],
+                        err.response["Error"]["Message"],
+                    )
+                raise
+    
+    
+    
+
+  * For API details, see [GetEmailIdentity](https://docs.aws.amazon.com/goto/boto3/sesv2-2019-09-27/GetEmailIdentity) in _AWS SDK for Python (Boto3) API Reference_. 
+
+
+
+
@@ -455 +583 @@ The following code example shows how to use `ListContacts`.
-There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2#code-examples). 
+There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2/newsletter_scenario#code-examples). 
@@ -503,0 +632,101 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
+The following code example shows how to use `SendBulkEmail`.
+
+**SDK for Python (Boto3)**
+    
+
+###### Note
+
+There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/sesv2/attachments_scenario#code-examples). 
+    
+    
+    class SESv2Wrapper:
+        """Encapsulates Amazon SESv2 email sending actions."""
+    
+        def __init__(self, sesv2_client: Any) -> None:
+            """
+            Initializes the SESv2Wrapper with an SESv2 client.
+    
+            :param sesv2_client: A Boto3 SESv2 client.
+            """
+            self.sesv2_client = sesv2_client
+    
+        @classmethod
+        def from_client(cls) -> "SESv2Wrapper":
+            """
+            Creates an SESv2Wrapper instance with a default Boto3 SESv2 client.
+    
+            :return: A new SESv2Wrapper instance.
+            """
+            sesv2_client = boto3.client("sesv2")
+            return cls(sesv2_client)
+    
+    
+        def send_bulk_email(
+            self,
+            from_address: str,
+            template_name: str,
+            default_template_data: str,