From 093b54192e3bdde733dd7c5d5995e6b3d9d7c108 Mon Sep 17 00:00:00 2001 From: ucloud-bot Date: Fri, 18 Sep 2026 03:07:43 +0000 Subject: [PATCH] sdk: rolling update for 0.3.54 --- VERSION | 2 +- src/SES/Apis/SendSESEmailRequest.php | 338 ++++++++++++++++++ src/SES/Apis/SendSESEmailResponse.php | 97 +++++ src/SES/Apis/SendSESEmailTemplateRequest.php | 291 +++++++++++++++ src/SES/Apis/SendSESEmailTemplateResponse.php | 97 +++++ src/SES/Models/FailedTargetEmail.php | 144 ++++++++ .../Params/SendSESEmailParamAttachments.php | 84 +++++ src/SES/Params/SendSESEmailParamHeaders.php | 64 ++++ .../SendSESEmailTemplateParamAttachments.php | 84 +++++ .../SendSESEmailTemplateParamEmailContent.php | 104 ++++++ .../SendSESEmailTemplateParamHeaders.php | 64 ++++ src/SES/SESClient.php | 157 ++++++++ 12 files changed, 1525 insertions(+), 1 deletion(-) create mode 100644 src/SES/Apis/SendSESEmailRequest.php create mode 100644 src/SES/Apis/SendSESEmailResponse.php create mode 100644 src/SES/Apis/SendSESEmailTemplateRequest.php create mode 100644 src/SES/Apis/SendSESEmailTemplateResponse.php create mode 100644 src/SES/Models/FailedTargetEmail.php create mode 100644 src/SES/Params/SendSESEmailParamAttachments.php create mode 100644 src/SES/Params/SendSESEmailParamHeaders.php create mode 100644 src/SES/Params/SendSESEmailTemplateParamAttachments.php create mode 100644 src/SES/Params/SendSESEmailTemplateParamEmailContent.php create mode 100644 src/SES/Params/SendSESEmailTemplateParamHeaders.php create mode 100644 src/SES/SESClient.php diff --git a/VERSION b/VERSION index db7aded3..aeb62e23 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.53 +0.3.54 diff --git a/src/SES/Apis/SendSESEmailRequest.php b/src/SES/Apis/SendSESEmailRequest.php new file mode 100644 index 00000000..4bab5a99 --- /dev/null +++ b/src/SES/Apis/SendSESEmailRequest.php @@ -0,0 +1,338 @@ + "SendSESEmail"]); + $this->markRequired("Subject"); + $this->markRequired("From"); + $this->markRequired("To"); + } + + + + /** + * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + * + * @return string|null + */ + public function getRegion() + { + return $this->get("Region"); + } + + /** + * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + * + * @param string $region + */ + public function setRegion($region) + { + $this->set("Region", $region); + } + + /** + * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + * + * @return string|null + */ + public function getZone() + { + return $this->get("Zone"); + } + + /** + * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + * + * @param string $zone + */ + public function setZone($zone) + { + $this->set("Zone", $zone); + } + + /** + * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + * + * @return string|null + */ + public function getProjectId() + { + return $this->get("ProjectId"); + } + + /** + * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + * + * @param string $projectId + */ + public function setProjectId($projectId) + { + $this->set("ProjectId", $projectId); + } + + /** + * Subject: 邮件主题(长度 1~200 字符) + * + * @return string|null + */ + public function getSubject() + { + return $this->get("Subject"); + } + + /** + * Subject: 邮件主题(长度 1~200 字符) + * + * @param string $subject + */ + public function setSubject($subject) + { + $this->set("Subject", $subject); + } + + /** + * From: 发件人邮箱,配置地址:https://console.ucloud.cn/ses/email-config?tab=sender-list + * + * @return string|null + */ + public function getFrom() + { + return $this->get("From"); + } + + /** + * From: 发件人邮箱,配置地址:https://console.ucloud.cn/ses/email-config?tab=sender-list + * + * @param string $from + */ + public function setFrom($from) + { + $this->set("From", $from); + } + + /** + * To: 收件人 + * + * @return string[]|null + */ + public function getTo() + { + return $this->get("To"); + } + + /** + * To: 收件人 + * + * @param string[] $to + */ + public function setTo(array $to) + { + $this->set("To", $to); + } + + /** + * Html: HTML 内容 (与Text二选一,长度上限 10,485,760个字符) + * + * @return string|null + */ + public function getHtml() + { + return $this->get("Html"); + } + + /** + * Html: HTML 内容 (与Text二选一,长度上限 10,485,760个字符) + * + * @param string $html + */ + public function setHtml($html) + { + $this->set("Html", $html); + } + + /** + * Text: 纯文本内容 (与Html二选一,长度上限 10,485,760个字符) + * + * @return string|null + */ + public function getText() + { + return $this->get("Text"); + } + + /** + * Text: 纯文本内容 (与Html二选一,长度上限 10,485,760个字符) + * + * @param string $text + */ + public function setText($text) + { + $this->set("Text", $text); + } + + /** + * PreHeader: 邮件预览文本 + * + * @return string|null + */ + public function getPreHeader() + { + return $this->get("PreHeader"); + } + + /** + * PreHeader: 邮件预览文本 + * + * @param string $preHeader + */ + public function setPreHeader($preHeader) + { + $this->set("PreHeader", $preHeader); + } + + /** + * FromName: 发件人名称,不传或为空时,自动回落到该发件人在控制台配置的别名(Alias) + * + * @return string|null + */ + public function getFromName() + { + return $this->get("FromName"); + } + + /** + * FromName: 发件人名称,不传或为空时,自动回落到该发件人在控制台配置的别名(Alias) + * + * @param string $fromName + */ + public function setFromName($fromName) + { + $this->set("FromName", $fromName); + } + + /** + * Cc: 抄送(抄送+密送总数量不能超过100) + * + * @return string[]|null + */ + public function getCc() + { + return $this->get("Cc"); + } + + /** + * Cc: 抄送(抄送+密送总数量不能超过100) + * + * @param string[] $cc + */ + public function setCc(array $cc) + { + $this->set("Cc", $cc); + } + + /** + * Bcc: 密送(抄送+密送总数量不能超过100) + * + * @return string[]|null + */ + public function getBcc() + { + return $this->get("Bcc"); + } + + /** + * Bcc: 密送(抄送+密送总数量不能超过100) + * + * @param string[] $bcc + */ + public function setBcc(array $bcc) + { + $this->set("Bcc", $bcc); + } + + /** + * Attachments: + * + * @return SendSESEmailParamAttachments[]|null + */ + public function getAttachments() + { + $items = $this->get("Attachments"); + if ($items == null) { + return []; + } + $result = []; + foreach ($items as $i => $item) { + array_push($result, new SendSESEmailParamAttachments($item)); + } + return $result; + } + + /** + * Attachments: + * + * @param SendSESEmailParamAttachments[] $attachments + */ + public function setAttachments(array $attachments) + { + $result = []; + foreach ($attachments as $i => $item) { + array_push($result, $item->getAll()); + } + return $result; + } + + /** + * Headers: + * + * @return SendSESEmailParamHeaders[]|null + */ + public function getHeaders() + { + $items = $this->get("Headers"); + if ($items == null) { + return []; + } + $result = []; + foreach ($items as $i => $item) { + array_push($result, new SendSESEmailParamHeaders($item)); + } + return $result; + } + + /** + * Headers: + * + * @param SendSESEmailParamHeaders[] $headers + */ + public function setHeaders(array $headers) + { + $result = []; + foreach ($headers as $i => $item) { + array_push($result, $item->getAll()); + } + return $result; + } +} diff --git a/src/SES/Apis/SendSESEmailResponse.php b/src/SES/Apis/SendSESEmailResponse.php new file mode 100644 index 00000000..2ddab56a --- /dev/null +++ b/src/SES/Apis/SendSESEmailResponse.php @@ -0,0 +1,97 @@ +get("SessionNo"); + } + + /** + * SessionNo: 本次发送任务的唯一标识 + * + * @param string $sessionNo + */ + public function setSessionNo($sessionNo) + { + $this->set("SessionNo", $sessionNo); + } + + /** + * SuccessCount: 发送成功数 + * + * @return integer|null + */ + public function getSuccessCount() + { + return $this->get("SuccessCount"); + } + + /** + * SuccessCount: 发送成功数 + * + * @param int $successCount + */ + public function setSuccessCount($successCount) + { + $this->set("SuccessCount", $successCount); + } + + /** + * FailContent: 发送失败的收件人列表 + * + * @return FailedTargetEmail[]|null + */ + public function getFailContent() + { + $items = $this->get("FailContent"); + if ($items == null) { + return []; + } + $result = []; + foreach ($items as $i => $item) { + array_push($result, new FailedTargetEmail($item)); + } + return $result; + } + + /** + * FailContent: 发送失败的收件人列表 + * + * @param FailedTargetEmail[] $failContent + */ + public function setFailContent(array $failContent) + { + $result = []; + foreach ($failContent as $i => $item) { + array_push($result, $item->getAll()); + } + return $result; + } +} diff --git a/src/SES/Apis/SendSESEmailTemplateRequest.php b/src/SES/Apis/SendSESEmailTemplateRequest.php new file mode 100644 index 00000000..a1185d9c --- /dev/null +++ b/src/SES/Apis/SendSESEmailTemplateRequest.php @@ -0,0 +1,291 @@ + "SendSESEmailTemplate"]); + $this->markRequired("TemplateId"); + $this->markRequired("From"); + $this->markRequired("Subject"); + } + + + + /** + * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + * + * @return string|null + */ + public function getRegion() + { + return $this->get("Region"); + } + + /** + * Region: 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + * + * @param string $region + */ + public function setRegion($region) + { + $this->set("Region", $region); + } + + /** + * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + * + * @return string|null + */ + public function getZone() + { + return $this->get("Zone"); + } + + /** + * Zone: 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + * + * @param string $zone + */ + public function setZone($zone) + { + $this->set("Zone", $zone); + } + + /** + * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + * + * @return string|null + */ + public function getProjectId() + { + return $this->get("ProjectId"); + } + + /** + * ProjectId: 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + * + * @param string $projectId + */ + public function setProjectId($projectId) + { + $this->set("ProjectId", $projectId); + } + + /** + * TemplateId: 模版 ID,获取:https://console.ucloud.cn/ses/email-config?tab=template + * + * @return string|null + */ + public function getTemplateId() + { + return $this->get("TemplateId"); + } + + /** + * TemplateId: 模版 ID,获取:https://console.ucloud.cn/ses/email-config?tab=template + * + * @param string $templateId + */ + public function setTemplateId($templateId) + { + $this->set("TemplateId", $templateId); + } + + /** + * From: 发件人邮箱 + * + * @return string|null + */ + public function getFrom() + { + return $this->get("From"); + } + + /** + * From: 发件人邮箱 + * + * @param string $from + */ + public function setFrom($from) + { + $this->set("From", $from); + } + + /** + * Subject: 邮件主题 + * + * @return string|null + */ + public function getSubject() + { + return $this->get("Subject"); + } + + /** + * Subject: 邮件主题 + * + * @param string $subject + */ + public function setSubject($subject) + { + $this->set("Subject", $subject); + } + + /** + * PreHeader: 邮件预览文本 + * + * @return string|null + */ + public function getPreHeader() + { + return $this->get("PreHeader"); + } + + /** + * PreHeader: 邮件预览文本 + * + * @param string $preHeader + */ + public function setPreHeader($preHeader) + { + $this->set("PreHeader", $preHeader); + } + + /** + * EmailContent: + * + * @return SendSESEmailTemplateParamEmailContent[]|null + */ + public function getEmailContent() + { + $items = $this->get("EmailContent"); + if ($items == null) { + return []; + } + $result = []; + foreach ($items as $i => $item) { + array_push($result, new SendSESEmailTemplateParamEmailContent($item)); + } + return $result; + } + + /** + * EmailContent: + * + * @param SendSESEmailTemplateParamEmailContent[] $emailContent + */ + public function setEmailContent(array $emailContent) + { + $result = []; + foreach ($emailContent as $i => $item) { + array_push($result, $item->getAll()); + } + return $result; + } + + /** + * FromName: 发件人名称,不传或为空时,自动回落到该发件人在控制台配置的别名(Alias) + * + * @return string|null + */ + public function getFromName() + { + return $this->get("FromName"); + } + + /** + * FromName: 发件人名称,不传或为空时,自动回落到该发件人在控制台配置的别名(Alias) + * + * @param string $fromName + */ + public function setFromName($fromName) + { + $this->set("FromName", $fromName); + } + + /** + * Attachments: + * + * @return SendSESEmailTemplateParamAttachments[]|null + */ + public function getAttachments() + { + $items = $this->get("Attachments"); + if ($items == null) { + return []; + } + $result = []; + foreach ($items as $i => $item) { + array_push($result, new SendSESEmailTemplateParamAttachments($item)); + } + return $result; + } + + /** + * Attachments: + * + * @param SendSESEmailTemplateParamAttachments[] $attachments + */ + public function setAttachments(array $attachments) + { + $result = []; + foreach ($attachments as $i => $item) { + array_push($result, $item->getAll()); + } + return $result; + } + + /** + * Headers: + * + * @return SendSESEmailTemplateParamHeaders[]|null + */ + public function getHeaders() + { + $items = $this->get("Headers"); + if ($items == null) { + return []; + } + $result = []; + foreach ($items as $i => $item) { + array_push($result, new SendSESEmailTemplateParamHeaders($item)); + } + return $result; + } + + /** + * Headers: + * + * @param SendSESEmailTemplateParamHeaders[] $headers + */ + public function setHeaders(array $headers) + { + $result = []; + foreach ($headers as $i => $item) { + array_push($result, $item->getAll()); + } + return $result; + } +} diff --git a/src/SES/Apis/SendSESEmailTemplateResponse.php b/src/SES/Apis/SendSESEmailTemplateResponse.php new file mode 100644 index 00000000..9c2c0e6f --- /dev/null +++ b/src/SES/Apis/SendSESEmailTemplateResponse.php @@ -0,0 +1,97 @@ +get("SessionNo"); + } + + /** + * SessionNo: 本次发送任务的唯一标识 + * + * @param string $sessionNo + */ + public function setSessionNo($sessionNo) + { + $this->set("SessionNo", $sessionNo); + } + + /** + * SuccessCount: 发送成功数 + * + * @return integer|null + */ + public function getSuccessCount() + { + return $this->get("SuccessCount"); + } + + /** + * SuccessCount: 发送成功数 + * + * @param int $successCount + */ + public function setSuccessCount($successCount) + { + $this->set("SuccessCount", $successCount); + } + + /** + * FailContent: 发送失败的收件人列表 + * + * @return FailedTargetEmail[]|null + */ + public function getFailContent() + { + $items = $this->get("FailContent"); + if ($items == null) { + return []; + } + $result = []; + foreach ($items as $i => $item) { + array_push($result, new FailedTargetEmail($item)); + } + return $result; + } + + /** + * FailContent: 发送失败的收件人列表 + * + * @param FailedTargetEmail[] $failContent + */ + public function setFailContent(array $failContent) + { + $result = []; + foreach ($failContent as $i => $item) { + array_push($result, $item->getAll()); + } + return $result; + } +} diff --git a/src/SES/Models/FailedTargetEmail.php b/src/SES/Models/FailedTargetEmail.php new file mode 100644 index 00000000..634a6790 --- /dev/null +++ b/src/SES/Models/FailedTargetEmail.php @@ -0,0 +1,144 @@ +get("To"); + } + + /** + * To: 收件人 + * + * @param string $to + */ + public function setTo($to) + { + $this->set("To", $to); + } + + /** + * EmailAddress: 收件邮箱 + * + * @return string|null + */ + public function getEmailAddress() + { + return $this->get("EmailAddress"); + } + + /** + * EmailAddress: 收件邮箱 + * + * @param string $emailAddress + */ + public function setEmailAddress($emailAddress) + { + $this->set("EmailAddress", $emailAddress); + } + + /** + * Cc: 抄送 + * + * @return string[]|null + */ + public function getCc() + { + return $this->get("Cc"); + } + + /** + * Cc: 抄送 + * + * @param string[] $cc + */ + public function setCc(array $cc) + { + $this->set("Cc", $cc); + } + + /** + * Bcc: 密送 + * + * @return string[]|null + */ + public function getBcc() + { + return $this->get("Bcc"); + } + + /** + * Bcc: 密送 + * + * @param string[] $bcc + */ + public function setBcc(array $bcc) + { + $this->set("Bcc", $bcc); + } + + /** + * TemplateVariableParams: 模版变量 + * + * @return string[]|null + */ + public function getTemplateVariableParams() + { + return $this->get("TemplateVariableParams"); + } + + /** + * TemplateVariableParams: 模版变量 + * + * @param string[] $templateVariableParams + */ + public function setTemplateVariableParams(array $templateVariableParams) + { + $this->set("TemplateVariableParams", $templateVariableParams); + } + + /** + * FailureReason: 失败原因 + * + * @return string|null + */ + public function getFailureReason() + { + return $this->get("FailureReason"); + } + + /** + * FailureReason: 失败原因 + * + * @param string $failureReason + */ + public function setFailureReason($failureReason) + { + $this->set("FailureReason", $failureReason); + } +} diff --git a/src/SES/Params/SendSESEmailParamAttachments.php b/src/SES/Params/SendSESEmailParamAttachments.php new file mode 100644 index 00000000..377b656b --- /dev/null +++ b/src/SES/Params/SendSESEmailParamAttachments.php @@ -0,0 +1,84 @@ +get("Filename"); + } + + /** + * Filename: 附件文件名 + * + * @param string $filename + */ + public function setFilename($filename) + { + $this->set("Filename", $filename); + } + + /** + * ContentType: MIME 类型,如: application/pdf + * + * @return string|null + */ + public function getContentType() + { + return $this->get("ContentType"); + } + + /** + * ContentType: MIME 类型,如: application/pdf + * + * @param string $contentType + */ + public function setContentType($contentType) + { + $this->set("ContentType", $contentType); + } + + /** + * Data: 附件内容(Base64 编码),单次请求最多 10 个附件;总大小不超过 10MB + * + * @return string|null + */ + public function getData() + { + return $this->get("Data"); + } + + /** + * Data: 附件内容(Base64 编码),单次请求最多 10 个附件;总大小不超过 10MB + * + * @param string $data + */ + public function setData($data) + { + $this->set("Data", $data); + } +} diff --git a/src/SES/Params/SendSESEmailParamHeaders.php b/src/SES/Params/SendSESEmailParamHeaders.php new file mode 100644 index 00000000..5b40f57b --- /dev/null +++ b/src/SES/Params/SendSESEmailParamHeaders.php @@ -0,0 +1,64 @@ +get("Name"); + } + + /** + * Name: 邮件头名称,最多 20 个且仅允许字母、数字和 -(正则 ^[A-Za-z0-9-]+$)。禁止使用保留名称:From/To/Cc/Bcc/Subject/Reply-To/Content-Type/Mime-Version,以及 X-SES- 前缀(均不区分大小写)。 + * + * @param string $name + */ + public function setName($name) + { + $this->set("Name", $name); + } + + /** + * Value: 邮件头值 + * + * @return string|null + */ + public function getValue() + { + return $this->get("Value"); + } + + /** + * Value: 邮件头值 + * + * @param string $value + */ + public function setValue($value) + { + $this->set("Value", $value); + } +} diff --git a/src/SES/Params/SendSESEmailTemplateParamAttachments.php b/src/SES/Params/SendSESEmailTemplateParamAttachments.php new file mode 100644 index 00000000..a555fd54 --- /dev/null +++ b/src/SES/Params/SendSESEmailTemplateParamAttachments.php @@ -0,0 +1,84 @@ +get("Filename"); + } + + /** + * Filename: 附件文件名 + * + * @param string $filename + */ + public function setFilename($filename) + { + $this->set("Filename", $filename); + } + + /** + * ContentType: MIME 类型,如: application/pdf + * + * @return string|null + */ + public function getContentType() + { + return $this->get("ContentType"); + } + + /** + * ContentType: MIME 类型,如: application/pdf + * + * @param string $contentType + */ + public function setContentType($contentType) + { + $this->set("ContentType", $contentType); + } + + /** + * Data: 附件内容(Base64 编码),单次请求最多 10 个附件;总大小不超过 10MB + * + * @return string|null + */ + public function getData() + { + return $this->get("Data"); + } + + /** + * Data: 附件内容(Base64 编码),单次请求最多 10 个附件;总大小不超过 10MB + * + * @param string $data + */ + public function setData($data) + { + $this->set("Data", $data); + } +} diff --git a/src/SES/Params/SendSESEmailTemplateParamEmailContent.php b/src/SES/Params/SendSESEmailTemplateParamEmailContent.php new file mode 100644 index 00000000..739eed53 --- /dev/null +++ b/src/SES/Params/SendSESEmailTemplateParamEmailContent.php @@ -0,0 +1,104 @@ +get("To"); + } + + /** + * To: 收件人,最多100条 + * + * @param string $to + */ + public function setTo($to) + { + $this->set("To", $to); + } + + /** + * Cc: 抄送(抄送+密送总数量不能超过100) + * + * @return string[]|null + */ + public function getCc() + { + return $this->get("Cc"); + } + + /** + * Cc: 抄送(抄送+密送总数量不能超过100) + * + * @param string[] $cc + */ + public function setCc(array $cc) + { + $this->set("Cc", $cc); + } + + /** + * Bcc: 密送(抄送+密送总数量不能超过100) + * + * @return string[]|null + */ + public function getBcc() + { + return $this->get("Bcc"); + } + + /** + * Bcc: 密送(抄送+密送总数量不能超过100) + * + * @param string[] $bcc + */ + public function setBcc(array $bcc) + { + $this->set("Bcc", $bcc); + } + + /** + * TemplateVariableParams: 模版变量,格式 variableName{##}variableValue (例:{"name{##}Tom", "code{##}1234"}) + * + * @return string[]|null + */ + public function getTemplateVariableParams() + { + return $this->get("TemplateVariableParams"); + } + + /** + * TemplateVariableParams: 模版变量,格式 variableName{##}variableValue (例:{"name{##}Tom", "code{##}1234"}) + * + * @param string[] $templateVariableParams + */ + public function setTemplateVariableParams(array $templateVariableParams) + { + $this->set("TemplateVariableParams", $templateVariableParams); + } +} diff --git a/src/SES/Params/SendSESEmailTemplateParamHeaders.php b/src/SES/Params/SendSESEmailTemplateParamHeaders.php new file mode 100644 index 00000000..55d70c00 --- /dev/null +++ b/src/SES/Params/SendSESEmailTemplateParamHeaders.php @@ -0,0 +1,64 @@ +get("Name"); + } + + /** + * Name: 邮件头名称,最多 20 个且仅允许字母、数字和 -(正则 ^[A-Za-z0-9-]+$)。禁止使用保留名称:From/To/Cc/Bcc/Subject/Reply-To/Content-Type/Mime-Version,以及 X-SES- 前缀(均不区分大小写)。 + * + * @param string $name + */ + public function setName($name) + { + $this->set("Name", $name); + } + + /** + * Value: 邮件头值 + * + * @return string|null + */ + public function getValue() + { + return $this->get("Value"); + } + + /** + * Value: 邮件头值 + * + * @param string $value + */ + public function setValue($value) + { + $this->set("Value", $value); + } +} diff --git a/src/SES/SESClient.php b/src/SES/SESClient.php new file mode 100644 index 00000000..42c8f4d1 --- /dev/null +++ b/src/SES/SESClient.php @@ -0,0 +1,157 @@ + (string) 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + * "Zone" => (string) 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + * "ProjectId" => (string) 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + * "Subject" => (string) 邮件主题(长度 1~200 字符) + * "From" => (string) 发件人邮箱,配置地址:https://console.ucloud.cn/ses/email-config?tab=sender-list + * "To" => (array) 收件人 + * "Html" => (string) HTML 内容 (与Text二选一,长度上限 10,485,760个字符) + * "Text" => (string) 纯文本内容 (与Html二选一,长度上限 10,485,760个字符) + * "PreHeader" => (string) 邮件预览文本 + * "FromName" => (string) 发件人名称,不传或为空时,自动回落到该发件人在控制台配置的别名(Alias) + * "Cc" => (array) 抄送(抄送+密送总数量不能超过100) + * "Bcc" => (array) 密送(抄送+密送总数量不能超过100) + * "Attachments" => (array) [ + * [ + * "Filename" => (string) 附件文件名 + * "ContentType" => (string) MIME 类型,如: application/pdf + * "Data" => (string) 附件内容(Base64 编码),单次请求最多 10 个附件;总大小不超过 10MB + * ] + * ] + * "Headers" => (array) [ + * [ + * "Name" => (string) 邮件头名称,最多 20 个且仅允许字母、数字和 -(正则 ^[A-Za-z0-9-]+$)。禁止使用保留名称:From/To/Cc/Bcc/Subject/Reply-To/Content-Type/Mime-Version,以及 X-SES- 前缀(均不区分大小写)。 + * "Value" => (string) 邮件头值 + * ] + * ] + * ] + * + * Outputs: + * + * $outputs = [ + * "SessionNo" => (string) 本次发送任务的唯一标识 + * "SuccessCount" => (integer) 发送成功数 + * "FailContent" => (array) 发送失败的收件人列表[ + * [ + * "To" => (string) 收件人 + * "EmailAddress" => (string) 收件邮箱 + * "Cc" => (array) 抄送 + * "Bcc" => (array) 密送 + * "TemplateVariableParams" => (array) 模版变量 + * "FailureReason" => (string) 失败原因 + * ] + * ] + * ] + * + * @return SendSESEmailResponse + * @throws UCloudException + */ + public function sendSESEmail(SendSESEmailRequest $request = null) + { + $resp = $this->invoke($request); + return new SendSESEmailResponse($resp->toArray(), $resp->getRequestId()); + } + + /** + * SendSESEmailTemplate - 通过模版发送邮件,无需创建发送任务。支持自定义主题、摘要、预览文本、抄送/密送、附件和邮件头,单次最多 100 个收件人。 + * + * See also: https://docs.ucloud.cn/api/ses-api/send_ses_email_template + * + * Arguments: + * + * $args = [ + * "Region" => (string) 地域。 参见 [地域和可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + * "Zone" => (string) 可用区。参见 [可用区列表](https://docs.ucloud.cn/api/summary/regionlist) + * "ProjectId" => (string) 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](https://docs.ucloud.cn/api/summary/get_project_list) + * "TemplateId" => (string) 模版 ID,获取:https://console.ucloud.cn/ses/email-config?tab=template + * "From" => (string) 发件人邮箱 + * "Subject" => (string) 邮件主题 + * "PreHeader" => (string) 邮件预览文本 + * "EmailContent" => (array) [ + * [ + * "To" => (string) 收件人,最多100条 + * "Cc" => (array) 抄送(抄送+密送总数量不能超过100) + * "Bcc" => (array) 密送(抄送+密送总数量不能超过100) + * "TemplateVariableParams" => (array) 模版变量,格式 variableName{##}variableValue (例:{"name{##}Tom", "code{##}1234"}) + * ] + * ] + * "FromName" => (string) 发件人名称,不传或为空时,自动回落到该发件人在控制台配置的别名(Alias) + * "Attachments" => (array) [ + * [ + * "Filename" => (string) 附件文件名 + * "ContentType" => (string) MIME 类型,如: application/pdf + * "Data" => (string) 附件内容(Base64 编码),单次请求最多 10 个附件;总大小不超过 10MB + * ] + * ] + * "Headers" => (array) [ + * [ + * "Name" => (string) 邮件头名称,最多 20 个且仅允许字母、数字和 -(正则 ^[A-Za-z0-9-]+$)。禁止使用保留名称:From/To/Cc/Bcc/Subject/Reply-To/Content-Type/Mime-Version,以及 X-SES- 前缀(均不区分大小写)。 + * "Value" => (string) 邮件头值 + * ] + * ] + * ] + * + * Outputs: + * + * $outputs = [ + * "SessionNo" => (string) 本次发送任务的唯一标识 + * "SuccessCount" => (integer) 发送成功数 + * "FailContent" => (array) 发送失败的收件人列表[ + * [ + * "To" => (string) 收件人 + * "EmailAddress" => (string) 收件邮箱 + * "Cc" => (array) 抄送 + * "Bcc" => (array) 密送 + * "TemplateVariableParams" => (array) 模版变量 + * "FailureReason" => (string) 失败原因 + * ] + * ] + * ] + * + * @return SendSESEmailTemplateResponse + * @throws UCloudException + */ + public function sendSESEmailTemplate(SendSESEmailTemplateRequest $request = null) + { + $resp = $this->invoke($request); + return new SendSESEmailTemplateResponse($resp->toArray(), $resp->getRequestId()); + } +}