AWS code-library medium security documentation change
Summary
Added two new code examples: GetEmailIdentity and SendBulkEmail for Amazon SES
Security assessment
Added email identity verification (GetEmailIdentity) and bulk email sending with security checks. Demonstrates security features like sender verification and error handling for unverified identities which prevent email spoofing and phishing attacks.
Diff
diff --git a/code-library/latest/ug/sap-abap_1_sesv2_code_examples.md b/code-library/latest/ug/sap-abap_1_sesv2_code_examples.md index 3a44c22dc..6e801fb48 100644 --- a//code-library/latest/ug/sap-abap_1_sesv2_code_examples.md +++ b//code-library/latest/ug/sap-abap_1_sesv2_code_examples.md @@ -238,0 +239,29 @@ 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 SAP ABAP** + + +###### 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/sap-abap/services/se2#code-examples). + + + TRY. + oo_result = lo_se2->getemailidentity( + iv_emailidentity = iv_email_identity ). + MESSAGE |Identity type: { oo_result->get_identitytype( ) }, | && + |verified for sending: { oo_result->get_verifiedforsendingstatus( ) }| TYPE 'I'. + CATCH /aws1/cx_se2notfoundexception. + MESSAGE |Email identity { iv_email_identity } not found.| TYPE 'I'. + CATCH /aws1/cx_se2badrequestex INTO DATA(lo_bad_request). + MESSAGE lo_bad_request TYPE 'I' DISPLAY LIKE 'E'. + RAISE EXCEPTION lo_bad_request. + ENDTRY. + + + + * For API details, see [GetEmailIdentity](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in _AWS SDK for SAP ABAP API reference_. + + + + @@ -268,0 +298,47 @@ 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 SAP ABAP** + + +###### 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/sap-abap/services/se2#code-examples). + + + TRY. + " Build the default template content used for all bulk recipients + DATA(lo_template) = NEW /aws1/cl_se2template( + iv_templatename = iv_template_name + iv_templatedata = iv_template_data ). + + DATA(lo_default_content) = NEW /aws1/cl_se2bulkemailcontent( + io_template = lo_template ). + + DATA(lo_result) = lo_se2->sendbulkemail( + iv_fromemailaddress = iv_from_address + io_defaultcontent = lo_default_content + it_bulkemailentries = it_bulk_entries ). + + ot_results = lo_result->get_bulkemailentryresults( ). + MESSAGE |Bulk email sent to { lines( it_bulk_entries ) } recipient(s).| TYPE 'I'. + CATCH /aws1/cx_se2messagerejected INTO DATA(lo_rejected). + MESSAGE lo_rejected TYPE 'I' DISPLAY LIKE 'E'. + RAISE EXCEPTION lo_rejected. + CATCH /aws1/cx_se2mailfrmdomnotver00 INTO DATA(lo_not_verified). + MESSAGE lo_not_verified TYPE 'I' DISPLAY LIKE 'E'. + RAISE EXCEPTION lo_not_verified. + CATCH /aws1/cx_se2notfoundexception INTO DATA(lo_not_found). + MESSAGE lo_not_found TYPE 'I' DISPLAY LIKE 'E'. + RAISE EXCEPTION lo_not_found. + CATCH /aws1/cx_se2badrequestex INTO DATA(lo_bad_request). + MESSAGE lo_bad_request TYPE 'I' DISPLAY LIKE 'E'. + RAISE EXCEPTION lo_bad_request. + ENDTRY. + + + + * For API details, see [SendBulkEmail](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in _AWS SDK for SAP ABAP API reference_. + + + +