使用 C++ SDK 的亚马逊SES示例 - AWS SDK代码示例

AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用 C++ SDK 的亚马逊SES示例

以下代码示例向您展示了如何通过 AWS SDK for C++ 与 Amazon 一起使用来执行操作和实现常见场景SES。

操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景的上下文查看操作。

场景是向您展示如何通过在一个服务中调用多个函数或与其他 AWS 服务结合来完成特定任务的代码示例。

每个示例都包含一个指向完整源代码的链接,您可以在其中找到有关如何在上下文中设置和运行代码的说明。

操作

以下代码示例显示了如何使用CreateReceiptFilter

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Create an Amazon Simple Email Service (Amazon SES) receipt filter.. /*! \param receiptFilterName: The name for the receipt filter. \param cidr: IP address or IP address range in Classless Inter-Domain Routing (CIDR) notation. \param policy: Block or allow enum of type ReceiptFilterPolicy. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::createReceiptFilter(const Aws::String &receiptFilterName, const Aws::String &cidr, Aws::SES::Model::ReceiptFilterPolicy policy, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::CreateReceiptFilterRequest createReceiptFilterRequest; Aws::SES::Model::ReceiptFilter receiptFilter; Aws::SES::Model::ReceiptIpFilter receiptIpFilter; receiptIpFilter.SetCidr(cidr); receiptIpFilter.SetPolicy(policy); receiptFilter.SetName(receiptFilterName); receiptFilter.SetIpFilter(receiptIpFilter); createReceiptFilterRequest.SetFilter(receiptFilter); Aws::SES::Model::CreateReceiptFilterOutcome createReceiptFilterOutcome = sesClient.CreateReceiptFilter( createReceiptFilterRequest); if (createReceiptFilterOutcome.IsSuccess()) { std::cout << "Successfully created receipt filter." << std::endl; } else { std::cerr << "Error creating receipt filter: " << createReceiptFilterOutcome.GetError().GetMessage() << std::endl; } return createReceiptFilterOutcome.IsSuccess(); }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 CreateReceiptFilter” 中的。

以下代码示例显示了如何使用CreateReceiptRule

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Create an Amazon Simple Email Service (Amazon SES) receipt rule. /*! \param receiptRuleName: The name for the receipt rule. \param s3BucketName: The name of the S3 bucket for incoming mail. \param s3ObjectKeyPrefix: The prefix for the objects in the S3 bucket. \param ruleSetName: The name of the rule set where the receipt rule is added. \param recipients: Aws::Vector of recipients. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::createReceiptRule(const Aws::String &receiptRuleName, const Aws::String &s3BucketName, const Aws::String &s3ObjectKeyPrefix, const Aws::String &ruleSetName, const Aws::Vector<Aws::String> &recipients, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::CreateReceiptRuleRequest createReceiptRuleRequest; Aws::SES::Model::S3Action s3Action; s3Action.SetBucketName(s3BucketName); s3Action.SetObjectKeyPrefix(s3ObjectKeyPrefix); Aws::SES::Model::ReceiptAction receiptAction; receiptAction.SetS3Action(s3Action); Aws::SES::Model::ReceiptRule receiptRule; receiptRule.SetName(receiptRuleName); receiptRule.WithRecipients(recipients); Aws::Vector<Aws::SES::Model::ReceiptAction> receiptActionList; receiptActionList.emplace_back(receiptAction); receiptRule.SetActions(receiptActionList); createReceiptRuleRequest.SetRuleSetName(ruleSetName); createReceiptRuleRequest.SetRule(receiptRule); auto outcome = sesClient.CreateReceiptRule(createReceiptRuleRequest); if (outcome.IsSuccess()) { std::cout << "Successfully created receipt rule." << std::endl; } else { std::cerr << "Error creating receipt rule. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 CreateReceiptRule” 中的。

以下代码示例显示了如何使用CreateReceiptRuleSet

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Create an Amazon Simple Email Service (Amazon SES) receipt rule set. /*! \param ruleSetName: The name of the rule set. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::createReceiptRuleSet(const Aws::String &ruleSetName, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::CreateReceiptRuleSetRequest createReceiptRuleSetRequest; createReceiptRuleSetRequest.SetRuleSetName(ruleSetName); Aws::SES::Model::CreateReceiptRuleSetOutcome outcome = sesClient.CreateReceiptRuleSet( createReceiptRuleSetRequest); if (outcome.IsSuccess()) { std::cout << "Successfully created receipt rule set." << std::endl; } else { std::cerr << "Error creating receipt rule set. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }

以下代码示例显示了如何使用CreateTemplate

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Create an Amazon Simple Email Service (Amazon SES) template. /*! \param templateName: The name of the template. \param htmlPart: The HTML body of the email. \param subjectPart: The subject line of the email. \param textPart: The plain text version of the email. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::createTemplate(const Aws::String &templateName, const Aws::String &htmlPart, const Aws::String &subjectPart, const Aws::String &textPart, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::CreateTemplateRequest createTemplateRequest; Aws::SES::Model::Template aTemplate; aTemplate.SetTemplateName(templateName); aTemplate.SetHtmlPart(htmlPart); aTemplate.SetSubjectPart(subjectPart); aTemplate.SetTextPart(textPart); createTemplateRequest.SetTemplate(aTemplate); Aws::SES::Model::CreateTemplateOutcome outcome = sesClient.CreateTemplate( createTemplateRequest); if (outcome.IsSuccess()) { std::cout << "Successfully created template." << templateName << "." << std::endl; } else { std::cerr << "Error creating template. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 CreateTemplate” 中的。

以下代码示例显示了如何使用DeleteIdentity

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Delete the specified identity (an email address or a domain). /*! \param identity: The identity to delete. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::deleteIdentity(const Aws::String &identity, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::DeleteIdentityRequest deleteIdentityRequest; deleteIdentityRequest.SetIdentity(identity); Aws::SES::Model::DeleteIdentityOutcome outcome = sesClient.DeleteIdentity( deleteIdentityRequest); if (outcome.IsSuccess()) { std::cout << "Successfully deleted identity." << std::endl; } else { std::cerr << "Error deleting identity. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 DeleteIdentity” 中的。

以下代码示例显示了如何使用DeleteReceiptFilter

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Delete an Amazon Simple Email Service (Amazon SES) receipt filter. /*! \param receiptFilterName: The name for the receipt filter. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::deleteReceiptFilter(const Aws::String &receiptFilterName, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::DeleteReceiptFilterRequest deleteReceiptFilterRequest; deleteReceiptFilterRequest.SetFilterName(receiptFilterName); Aws::SES::Model::DeleteReceiptFilterOutcome outcome = sesClient.DeleteReceiptFilter( deleteReceiptFilterRequest); if (outcome.IsSuccess()) { std::cout << "Successfully deleted receipt filter." << std::endl; } else { std::cerr << "Error deleting receipt filter. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 DeleteReceiptFilter” 中的。

以下代码示例显示了如何使用DeleteReceiptRule

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Delete an Amazon Simple Email Service (Amazon SES) receipt rule. /*! \param receiptRuleName: The name for the receipt rule. \param receiptRuleSetName: The name for the receipt rule set. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::deleteReceiptRule(const Aws::String &receiptRuleName, const Aws::String &receiptRuleSetName, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::DeleteReceiptRuleRequest deleteReceiptRuleRequest; deleteReceiptRuleRequest.SetRuleName(receiptRuleName); deleteReceiptRuleRequest.SetRuleSetName(receiptRuleSetName); Aws::SES::Model::DeleteReceiptRuleOutcome outcome = sesClient.DeleteReceiptRule( deleteReceiptRuleRequest); if (outcome.IsSuccess()) { std::cout << "Successfully deleted receipt rule." << std::endl; } else { std::cout << "Error deleting receipt rule. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 DeleteReceiptRule” 中的。

以下代码示例显示了如何使用DeleteReceiptRuleSet

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Delete an Amazon Simple Email Service (Amazon SES) receipt rule set. /*! \param receiptRuleSetName: The name for the receipt rule set. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::deleteReceiptRuleSet(const Aws::String &receiptRuleSetName, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::DeleteReceiptRuleSetRequest deleteReceiptRuleSetRequest; deleteReceiptRuleSetRequest.SetRuleSetName(receiptRuleSetName); Aws::SES::Model::DeleteReceiptRuleSetOutcome outcome = sesClient.DeleteReceiptRuleSet( deleteReceiptRuleSetRequest); if (outcome.IsSuccess()) { std::cout << "Successfully deleted receipt rule set." << std::endl; } else { std::cerr << "Error deleting receipt rule set. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }

以下代码示例显示了如何使用DeleteTemplate

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Delete an Amazon Simple Email Service (Amazon SES) template. /*! \param templateName: The name for the template. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::deleteTemplate(const Aws::String &templateName, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::DeleteTemplateRequest deleteTemplateRequest; deleteTemplateRequest.SetTemplateName(templateName); Aws::SES::Model::DeleteTemplateOutcome outcome = sesClient.DeleteTemplate( deleteTemplateRequest); if (outcome.IsSuccess()) { std::cout << "Successfully deleted template." << std::endl; } else { std::cerr << "Error deleting template. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 DeleteTemplate” 中的。

以下代码示例显示了如何使用GetTemplate

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Get a template's attributes. /*! \param templateName: The name for the template. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::getTemplate(const Aws::String &templateName, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::GetTemplateRequest getTemplateRequest; getTemplateRequest.SetTemplateName(templateName); Aws::SES::Model::GetTemplateOutcome outcome = sesClient.GetTemplate( getTemplateRequest); if (outcome.IsSuccess()) { std::cout << "Successfully got template." << std::endl; } else { std::cerr << "Error getting template. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 GetTemplate” 中的。

以下代码示例显示了如何使用ListIdentities

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! List the identities associated with this account. /*! \param identityType: The identity type enum. "NOT_SET" is a valid option. \param identities; A vector to receive the retrieved identities. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::listIdentities(Aws::SES::Model::IdentityType identityType, Aws::Vector<Aws::String> &identities, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::ListIdentitiesRequest listIdentitiesRequest; if (identityType != Aws::SES::Model::IdentityType::NOT_SET) { listIdentitiesRequest.SetIdentityType(identityType); } Aws::String nextToken; // Used for paginated results. do { if (!nextToken.empty()) { listIdentitiesRequest.SetNextToken(nextToken); } Aws::SES::Model::ListIdentitiesOutcome outcome = sesClient.ListIdentities( listIdentitiesRequest); if (outcome.IsSuccess()) { const auto &retrievedIdentities = outcome.GetResult().GetIdentities(); if (!retrievedIdentities.empty()) { identities.insert(identities.cend(), retrievedIdentities.cbegin(), retrievedIdentities.cend()); } nextToken = outcome.GetResult().GetNextToken(); } else { std::cout << "Error listing identities. " << outcome.GetError().GetMessage() << std::endl; return false; } } while (!nextToken.empty()); return true; }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 ListIdentities” 中的。

以下代码示例显示了如何使用ListReceiptFilters

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! List the receipt filters associated with this account. /*! \param filters; A vector of "ReceiptFilter" to receive the retrieved filters. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::listReceiptFilters(Aws::Vector<Aws::SES::Model::ReceiptFilter> &filters, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::ListReceiptFiltersRequest listReceiptFiltersRequest; Aws::SES::Model::ListReceiptFiltersOutcome outcome = sesClient.ListReceiptFilters( listReceiptFiltersRequest); if (outcome.IsSuccess()) { auto &retrievedFilters = outcome.GetResult().GetFilters(); if (!retrievedFilters.empty()) { filters.insert(filters.cend(), retrievedFilters.cbegin(), retrievedFilters.cend()); } } else { std::cerr << "Error retrieving IP address filters: " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 ListReceiptFilters” 中的。

以下代码示例显示了如何使用SendEmail

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Send an email to a list of recipients. /*! \param recipients; Vector of recipient email addresses. \param subject: Email subject. \param htmlBody: Email body as HTML. At least one body data is required. \param textBody: Email body as plain text. At least one body data is required. \param senderEmailAddress: Email address of sender. Ignored if empty string. \param ccAddresses: Vector of cc addresses. Ignored if empty. \param replyToAddress: Reply to email address. Ignored if empty string. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::sendEmail(const Aws::Vector<Aws::String> &recipients, const Aws::String &subject, const Aws::String &htmlBody, const Aws::String &textBody, const Aws::String &senderEmailAddress, const Aws::Vector<Aws::String> &ccAddresses, const Aws::String &replyToAddress, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::Destination destination; if (!ccAddresses.empty()) { destination.WithCcAddresses(ccAddresses); } if (!recipients.empty()) { destination.WithToAddresses(recipients); } Aws::SES::Model::Body message_body; if (!htmlBody.empty()) { message_body.SetHtml( Aws::SES::Model::Content().WithCharset("UTF-8").WithData(htmlBody)); } if (!textBody.empty()) { message_body.SetText( Aws::SES::Model::Content().WithCharset("UTF-8").WithData(textBody)); } Aws::SES::Model::Message message; message.SetBody(message_body); message.SetSubject( Aws::SES::Model::Content().WithCharset("UTF-8").WithData(subject)); Aws::SES::Model::SendEmailRequest sendEmailRequest; sendEmailRequest.SetDestination(destination); sendEmailRequest.SetMessage(message); if (!senderEmailAddress.empty()) { sendEmailRequest.SetSource(senderEmailAddress); } if (!replyToAddress.empty()) { sendEmailRequest.AddReplyToAddresses(replyToAddress); } auto outcome = sesClient.SendEmail(sendEmailRequest); if (outcome.IsSuccess()) { std::cout << "Successfully sent message with ID " << outcome.GetResult().GetMessageId() << "." << std::endl; } else { std::cerr << "Error sending message. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 SendEmail” 中的。

以下代码示例显示了如何使用SendTemplatedEmail

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Send a templated email to a list of recipients. /*! \param recipients; Vector of recipient email addresses. \param templateName: The name of the template to use. \param templateData: Map of key-value pairs for replacing text in template. \param senderEmailAddress: Email address of sender. Ignored if empty string. \param ccAddresses: Vector of cc addresses. Ignored if empty. \param replyToAddress: Reply to email address. Ignored if empty string. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::sendTemplatedEmail(const Aws::Vector<Aws::String> &recipients, const Aws::String &templateName, const Aws::Map<Aws::String, Aws::String> &templateData, const Aws::String &senderEmailAddress, const Aws::Vector<Aws::String> &ccAddresses, const Aws::String &replyToAddress, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::Destination destination; if (!ccAddresses.empty()) { destination.WithCcAddresses(ccAddresses); } if (!recipients.empty()) { destination.WithToAddresses(recipients); } Aws::SES::Model::SendTemplatedEmailRequest sendTemplatedEmailRequest; sendTemplatedEmailRequest.SetDestination(destination); sendTemplatedEmailRequest.SetTemplate(templateName); std::ostringstream templateDataStream; templateDataStream << "{"; size_t dataCount = 0; for (auto &pair: templateData) { templateDataStream << "\"" << pair.first << "\":\"" << pair.second << "\""; dataCount++; if (dataCount < templateData.size()) { templateDataStream << ","; } } templateDataStream << "}"; sendTemplatedEmailRequest.SetTemplateData(templateDataStream.str()); if (!senderEmailAddress.empty()) { sendTemplatedEmailRequest.SetSource(senderEmailAddress); } if (!replyToAddress.empty()) { sendTemplatedEmailRequest.AddReplyToAddresses(replyToAddress); } auto outcome = sesClient.SendTemplatedEmail(sendTemplatedEmailRequest); if (outcome.IsSuccess()) { std::cout << "Successfully sent templated message with ID " << outcome.GetResult().GetMessageId() << "." << std::endl; } else { std::cerr << "Error sending templated message. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 SendTemplatedEmail” 中的。

以下代码示例显示了如何使用UpdateTemplate

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Update an Amazon Simple Email Service (Amazon SES) template. /*! \param templateName: The name of the template. \param htmlPart: The HTML body of the email. \param subjectPart: The subject line of the email. \param textPart: The plain text version of the email. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::updateTemplate(const Aws::String &templateName, const Aws::String &htmlPart, const Aws::String &subjectPart, const Aws::String &textPart, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::Template templateValues; templateValues.SetTemplateName(templateName); templateValues.SetSubjectPart(subjectPart); templateValues.SetHtmlPart(htmlPart); templateValues.SetTextPart(textPart); Aws::SES::Model::UpdateTemplateRequest updateTemplateRequest; updateTemplateRequest.SetTemplate(templateValues); Aws::SES::Model::UpdateTemplateOutcome outcome = sesClient.UpdateTemplate(updateTemplateRequest); if (outcome.IsSuccess()) { std::cout << "Successfully updated template." << std::endl; } else { std::cerr << "Error updating template. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 UpdateTemplate” 中的。

以下代码示例显示了如何使用VerifyEmailIdentity

SDK对于 C++
注意

还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库中进行设置和运行。

//! Add an email address to the list of identities associated with this account and //! initiate verification. /*! \param emailAddress; The email address to add. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::SES::verifyEmailIdentity(const Aws::String &emailAddress, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::SES::SESClient sesClient(clientConfiguration); Aws::SES::Model::VerifyEmailIdentityRequest verifyEmailIdentityRequest; verifyEmailIdentityRequest.SetEmailAddress(emailAddress); Aws::SES::Model::VerifyEmailIdentityOutcome outcome = sesClient.VerifyEmailIdentity(verifyEmailIdentityRequest); if (outcome.IsSuccess()) { std::cout << "Email verification initiated." << std::endl; } else { std::cerr << "Error initiating email verification. " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
  • 有关API详细信息,请参阅 “AWS SDK for C++ API参考 VerifyEmailIdentity” 中的。

场景

以下代码示例演示如何创建一个 Web 应用程序,该应用程序可跟踪 Amazon Aurora Serverless 数据库中的工作项目,并使用亚马逊简单电子邮件服务 (AmazonSES) 发送报告。

SDK对于 C++

演示了如何创建用于跟踪和报告存储在 Amazon Aurora Serverless 数据库中的工作项的 Web 应用程序。

有关如何设置查询 Amazon Aurora Serverless 数据RESTAPI的 C++ 以及 React 应用程序使用的完整源代码和说明,请参阅上的GitHub完整示例。

本示例中使用的服务
  • Aurora

  • Amazon RDS

  • 亚马逊RDS数据服务

  • Amazon SES