1 |
efrain |
1 |
<?php
|
|
|
2 |
namespace Aws\Ses;
|
|
|
3 |
|
|
|
4 |
use Aws\Api\ApiProvider;
|
|
|
5 |
use Aws\Api\DocModel;
|
|
|
6 |
use Aws\Api\Service;
|
|
|
7 |
use Aws\Credentials\CredentialsInterface;
|
|
|
8 |
|
|
|
9 |
/**
|
|
|
10 |
* This client is used to interact with the **Amazon Simple Email Service (Amazon SES)**.
|
|
|
11 |
*
|
|
|
12 |
* @method \Aws\Result cloneReceiptRuleSet(array $args = [])
|
|
|
13 |
* @method \GuzzleHttp\Promise\Promise cloneReceiptRuleSetAsync(array $args = [])
|
|
|
14 |
* @method \Aws\Result createConfigurationSet(array $args = [])
|
|
|
15 |
* @method \GuzzleHttp\Promise\Promise createConfigurationSetAsync(array $args = [])
|
|
|
16 |
* @method \Aws\Result createConfigurationSetEventDestination(array $args = [])
|
|
|
17 |
* @method \GuzzleHttp\Promise\Promise createConfigurationSetEventDestinationAsync(array $args = [])
|
|
|
18 |
* @method \Aws\Result createConfigurationSetTrackingOptions(array $args = [])
|
|
|
19 |
* @method \GuzzleHttp\Promise\Promise createConfigurationSetTrackingOptionsAsync(array $args = [])
|
|
|
20 |
* @method \Aws\Result createCustomVerificationEmailTemplate(array $args = [])
|
|
|
21 |
* @method \GuzzleHttp\Promise\Promise createCustomVerificationEmailTemplateAsync(array $args = [])
|
|
|
22 |
* @method \Aws\Result createReceiptFilter(array $args = [])
|
|
|
23 |
* @method \GuzzleHttp\Promise\Promise createReceiptFilterAsync(array $args = [])
|
|
|
24 |
* @method \Aws\Result createReceiptRule(array $args = [])
|
|
|
25 |
* @method \GuzzleHttp\Promise\Promise createReceiptRuleAsync(array $args = [])
|
|
|
26 |
* @method \Aws\Result createReceiptRuleSet(array $args = [])
|
|
|
27 |
* @method \GuzzleHttp\Promise\Promise createReceiptRuleSetAsync(array $args = [])
|
|
|
28 |
* @method \Aws\Result createTemplate(array $args = [])
|
|
|
29 |
* @method \GuzzleHttp\Promise\Promise createTemplateAsync(array $args = [])
|
|
|
30 |
* @method \Aws\Result deleteConfigurationSet(array $args = [])
|
|
|
31 |
* @method \GuzzleHttp\Promise\Promise deleteConfigurationSetAsync(array $args = [])
|
|
|
32 |
* @method \Aws\Result deleteConfigurationSetEventDestination(array $args = [])
|
|
|
33 |
* @method \GuzzleHttp\Promise\Promise deleteConfigurationSetEventDestinationAsync(array $args = [])
|
|
|
34 |
* @method \Aws\Result deleteConfigurationSetTrackingOptions(array $args = [])
|
|
|
35 |
* @method \GuzzleHttp\Promise\Promise deleteConfigurationSetTrackingOptionsAsync(array $args = [])
|
|
|
36 |
* @method \Aws\Result deleteCustomVerificationEmailTemplate(array $args = [])
|
|
|
37 |
* @method \GuzzleHttp\Promise\Promise deleteCustomVerificationEmailTemplateAsync(array $args = [])
|
|
|
38 |
* @method \Aws\Result deleteIdentity(array $args = [])
|
|
|
39 |
* @method \GuzzleHttp\Promise\Promise deleteIdentityAsync(array $args = [])
|
|
|
40 |
* @method \Aws\Result deleteIdentityPolicy(array $args = [])
|
|
|
41 |
* @method \GuzzleHttp\Promise\Promise deleteIdentityPolicyAsync(array $args = [])
|
|
|
42 |
* @method \Aws\Result deleteReceiptFilter(array $args = [])
|
|
|
43 |
* @method \GuzzleHttp\Promise\Promise deleteReceiptFilterAsync(array $args = [])
|
|
|
44 |
* @method \Aws\Result deleteReceiptRule(array $args = [])
|
|
|
45 |
* @method \GuzzleHttp\Promise\Promise deleteReceiptRuleAsync(array $args = [])
|
|
|
46 |
* @method \Aws\Result deleteReceiptRuleSet(array $args = [])
|
|
|
47 |
* @method \GuzzleHttp\Promise\Promise deleteReceiptRuleSetAsync(array $args = [])
|
|
|
48 |
* @method \Aws\Result deleteTemplate(array $args = [])
|
|
|
49 |
* @method \GuzzleHttp\Promise\Promise deleteTemplateAsync(array $args = [])
|
|
|
50 |
* @method \Aws\Result deleteVerifiedEmailAddress(array $args = [])
|
|
|
51 |
* @method \GuzzleHttp\Promise\Promise deleteVerifiedEmailAddressAsync(array $args = [])
|
|
|
52 |
* @method \Aws\Result describeActiveReceiptRuleSet(array $args = [])
|
|
|
53 |
* @method \GuzzleHttp\Promise\Promise describeActiveReceiptRuleSetAsync(array $args = [])
|
|
|
54 |
* @method \Aws\Result describeConfigurationSet(array $args = [])
|
|
|
55 |
* @method \GuzzleHttp\Promise\Promise describeConfigurationSetAsync(array $args = [])
|
|
|
56 |
* @method \Aws\Result describeReceiptRule(array $args = [])
|
|
|
57 |
* @method \GuzzleHttp\Promise\Promise describeReceiptRuleAsync(array $args = [])
|
|
|
58 |
* @method \Aws\Result describeReceiptRuleSet(array $args = [])
|
|
|
59 |
* @method \GuzzleHttp\Promise\Promise describeReceiptRuleSetAsync(array $args = [])
|
|
|
60 |
* @method \Aws\Result getAccountSendingEnabled(array $args = [])
|
|
|
61 |
* @method \GuzzleHttp\Promise\Promise getAccountSendingEnabledAsync(array $args = [])
|
|
|
62 |
* @method \Aws\Result getCustomVerificationEmailTemplate(array $args = [])
|
|
|
63 |
* @method \GuzzleHttp\Promise\Promise getCustomVerificationEmailTemplateAsync(array $args = [])
|
|
|
64 |
* @method \Aws\Result getIdentityDkimAttributes(array $args = [])
|
|
|
65 |
* @method \GuzzleHttp\Promise\Promise getIdentityDkimAttributesAsync(array $args = [])
|
|
|
66 |
* @method \Aws\Result getIdentityMailFromDomainAttributes(array $args = [])
|
|
|
67 |
* @method \GuzzleHttp\Promise\Promise getIdentityMailFromDomainAttributesAsync(array $args = [])
|
|
|
68 |
* @method \Aws\Result getIdentityNotificationAttributes(array $args = [])
|
|
|
69 |
* @method \GuzzleHttp\Promise\Promise getIdentityNotificationAttributesAsync(array $args = [])
|
|
|
70 |
* @method \Aws\Result getIdentityPolicies(array $args = [])
|
|
|
71 |
* @method \GuzzleHttp\Promise\Promise getIdentityPoliciesAsync(array $args = [])
|
|
|
72 |
* @method \Aws\Result getIdentityVerificationAttributes(array $args = [])
|
|
|
73 |
* @method \GuzzleHttp\Promise\Promise getIdentityVerificationAttributesAsync(array $args = [])
|
|
|
74 |
* @method \Aws\Result getSendQuota(array $args = [])
|
|
|
75 |
* @method \GuzzleHttp\Promise\Promise getSendQuotaAsync(array $args = [])
|
|
|
76 |
* @method \Aws\Result getSendStatistics(array $args = [])
|
|
|
77 |
* @method \GuzzleHttp\Promise\Promise getSendStatisticsAsync(array $args = [])
|
|
|
78 |
* @method \Aws\Result getTemplate(array $args = [])
|
|
|
79 |
* @method \GuzzleHttp\Promise\Promise getTemplateAsync(array $args = [])
|
|
|
80 |
* @method \Aws\Result listConfigurationSets(array $args = [])
|
|
|
81 |
* @method \GuzzleHttp\Promise\Promise listConfigurationSetsAsync(array $args = [])
|
|
|
82 |
* @method \Aws\Result listCustomVerificationEmailTemplates(array $args = [])
|
|
|
83 |
* @method \GuzzleHttp\Promise\Promise listCustomVerificationEmailTemplatesAsync(array $args = [])
|
|
|
84 |
* @method \Aws\Result listIdentities(array $args = [])
|
|
|
85 |
* @method \GuzzleHttp\Promise\Promise listIdentitiesAsync(array $args = [])
|
|
|
86 |
* @method \Aws\Result listIdentityPolicies(array $args = [])
|
|
|
87 |
* @method \GuzzleHttp\Promise\Promise listIdentityPoliciesAsync(array $args = [])
|
|
|
88 |
* @method \Aws\Result listReceiptFilters(array $args = [])
|
|
|
89 |
* @method \GuzzleHttp\Promise\Promise listReceiptFiltersAsync(array $args = [])
|
|
|
90 |
* @method \Aws\Result listReceiptRuleSets(array $args = [])
|
|
|
91 |
* @method \GuzzleHttp\Promise\Promise listReceiptRuleSetsAsync(array $args = [])
|
|
|
92 |
* @method \Aws\Result listTemplates(array $args = [])
|
|
|
93 |
* @method \GuzzleHttp\Promise\Promise listTemplatesAsync(array $args = [])
|
|
|
94 |
* @method \Aws\Result listVerifiedEmailAddresses(array $args = [])
|
|
|
95 |
* @method \GuzzleHttp\Promise\Promise listVerifiedEmailAddressesAsync(array $args = [])
|
|
|
96 |
* @method \Aws\Result putConfigurationSetDeliveryOptions(array $args = [])
|
|
|
97 |
* @method \GuzzleHttp\Promise\Promise putConfigurationSetDeliveryOptionsAsync(array $args = [])
|
|
|
98 |
* @method \Aws\Result putIdentityPolicy(array $args = [])
|
|
|
99 |
* @method \GuzzleHttp\Promise\Promise putIdentityPolicyAsync(array $args = [])
|
|
|
100 |
* @method \Aws\Result reorderReceiptRuleSet(array $args = [])
|
|
|
101 |
* @method \GuzzleHttp\Promise\Promise reorderReceiptRuleSetAsync(array $args = [])
|
|
|
102 |
* @method \Aws\Result sendBounce(array $args = [])
|
|
|
103 |
* @method \GuzzleHttp\Promise\Promise sendBounceAsync(array $args = [])
|
|
|
104 |
* @method \Aws\Result sendBulkTemplatedEmail(array $args = [])
|
|
|
105 |
* @method \GuzzleHttp\Promise\Promise sendBulkTemplatedEmailAsync(array $args = [])
|
|
|
106 |
* @method \Aws\Result sendCustomVerificationEmail(array $args = [])
|
|
|
107 |
* @method \GuzzleHttp\Promise\Promise sendCustomVerificationEmailAsync(array $args = [])
|
|
|
108 |
* @method \Aws\Result sendEmail(array $args = [])
|
|
|
109 |
* @method \GuzzleHttp\Promise\Promise sendEmailAsync(array $args = [])
|
|
|
110 |
* @method \Aws\Result sendRawEmail(array $args = [])
|
|
|
111 |
* @method \GuzzleHttp\Promise\Promise sendRawEmailAsync(array $args = [])
|
|
|
112 |
* @method \Aws\Result sendTemplatedEmail(array $args = [])
|
|
|
113 |
* @method \GuzzleHttp\Promise\Promise sendTemplatedEmailAsync(array $args = [])
|
|
|
114 |
* @method \Aws\Result setActiveReceiptRuleSet(array $args = [])
|
|
|
115 |
* @method \GuzzleHttp\Promise\Promise setActiveReceiptRuleSetAsync(array $args = [])
|
|
|
116 |
* @method \Aws\Result setIdentityDkimEnabled(array $args = [])
|
|
|
117 |
* @method \GuzzleHttp\Promise\Promise setIdentityDkimEnabledAsync(array $args = [])
|
|
|
118 |
* @method \Aws\Result setIdentityFeedbackForwardingEnabled(array $args = [])
|
|
|
119 |
* @method \GuzzleHttp\Promise\Promise setIdentityFeedbackForwardingEnabledAsync(array $args = [])
|
|
|
120 |
* @method \Aws\Result setIdentityHeadersInNotificationsEnabled(array $args = [])
|
|
|
121 |
* @method \GuzzleHttp\Promise\Promise setIdentityHeadersInNotificationsEnabledAsync(array $args = [])
|
|
|
122 |
* @method \Aws\Result setIdentityMailFromDomain(array $args = [])
|
|
|
123 |
* @method \GuzzleHttp\Promise\Promise setIdentityMailFromDomainAsync(array $args = [])
|
|
|
124 |
* @method \Aws\Result setIdentityNotificationTopic(array $args = [])
|
|
|
125 |
* @method \GuzzleHttp\Promise\Promise setIdentityNotificationTopicAsync(array $args = [])
|
|
|
126 |
* @method \Aws\Result setReceiptRulePosition(array $args = [])
|
|
|
127 |
* @method \GuzzleHttp\Promise\Promise setReceiptRulePositionAsync(array $args = [])
|
|
|
128 |
* @method \Aws\Result testRenderTemplate(array $args = [])
|
|
|
129 |
* @method \GuzzleHttp\Promise\Promise testRenderTemplateAsync(array $args = [])
|
|
|
130 |
* @method \Aws\Result updateAccountSendingEnabled(array $args = [])
|
|
|
131 |
* @method \GuzzleHttp\Promise\Promise updateAccountSendingEnabledAsync(array $args = [])
|
|
|
132 |
* @method \Aws\Result updateConfigurationSetEventDestination(array $args = [])
|
|
|
133 |
* @method \GuzzleHttp\Promise\Promise updateConfigurationSetEventDestinationAsync(array $args = [])
|
|
|
134 |
* @method \Aws\Result updateConfigurationSetReputationMetricsEnabled(array $args = [])
|
|
|
135 |
* @method \GuzzleHttp\Promise\Promise updateConfigurationSetReputationMetricsEnabledAsync(array $args = [])
|
|
|
136 |
* @method \Aws\Result updateConfigurationSetSendingEnabled(array $args = [])
|
|
|
137 |
* @method \GuzzleHttp\Promise\Promise updateConfigurationSetSendingEnabledAsync(array $args = [])
|
|
|
138 |
* @method \Aws\Result updateConfigurationSetTrackingOptions(array $args = [])
|
|
|
139 |
* @method \GuzzleHttp\Promise\Promise updateConfigurationSetTrackingOptionsAsync(array $args = [])
|
|
|
140 |
* @method \Aws\Result updateCustomVerificationEmailTemplate(array $args = [])
|
|
|
141 |
* @method \GuzzleHttp\Promise\Promise updateCustomVerificationEmailTemplateAsync(array $args = [])
|
|
|
142 |
* @method \Aws\Result updateReceiptRule(array $args = [])
|
|
|
143 |
* @method \GuzzleHttp\Promise\Promise updateReceiptRuleAsync(array $args = [])
|
|
|
144 |
* @method \Aws\Result updateTemplate(array $args = [])
|
|
|
145 |
* @method \GuzzleHttp\Promise\Promise updateTemplateAsync(array $args = [])
|
|
|
146 |
* @method \Aws\Result verifyDomainDkim(array $args = [])
|
|
|
147 |
* @method \GuzzleHttp\Promise\Promise verifyDomainDkimAsync(array $args = [])
|
|
|
148 |
* @method \Aws\Result verifyDomainIdentity(array $args = [])
|
|
|
149 |
* @method \GuzzleHttp\Promise\Promise verifyDomainIdentityAsync(array $args = [])
|
|
|
150 |
* @method \Aws\Result verifyEmailAddress(array $args = [])
|
|
|
151 |
* @method \GuzzleHttp\Promise\Promise verifyEmailAddressAsync(array $args = [])
|
|
|
152 |
* @method \Aws\Result verifyEmailIdentity(array $args = [])
|
|
|
153 |
* @method \GuzzleHttp\Promise\Promise verifyEmailIdentityAsync(array $args = [])
|
|
|
154 |
*/
|
|
|
155 |
class SesClient extends \Aws\AwsClient
|
|
|
156 |
{
|
|
|
157 |
/**
|
|
|
158 |
* @deprecated This method will no longer work due to the deprecation of
|
|
|
159 |
* V2 credentials with SES as of 03/25/2021
|
|
|
160 |
* Create an SMTP password for a given IAM user's credentials.
|
|
|
161 |
*
|
|
|
162 |
* The SMTP username is the Access Key ID for the provided credentials.
|
|
|
163 |
*
|
|
|
164 |
* @link http://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html#smtp-credentials-convert
|
|
|
165 |
*
|
|
|
166 |
* @param CredentialsInterface $creds
|
|
|
167 |
*
|
|
|
168 |
* @return string
|
|
|
169 |
*/
|
|
|
170 |
public static function generateSmtpPassword(CredentialsInterface $creds)
|
|
|
171 |
{
|
|
|
172 |
static $version = "\x02";
|
|
|
173 |
static $algo = 'sha256';
|
|
|
174 |
static $message = 'SendRawEmail';
|
|
|
175 |
$signature = hash_hmac($algo, $message, $creds->getSecretKey(), true);
|
|
|
176 |
|
|
|
177 |
return base64_encode($version . $signature);
|
|
|
178 |
}
|
|
|
179 |
|
|
|
180 |
/**
|
|
|
181 |
* Create an SMTP password for a given IAM user's credentials.
|
|
|
182 |
*
|
|
|
183 |
* The SMTP username is the Access Key ID for the provided credentials. This
|
|
|
184 |
* utility method is not guaranteed to work indefinitely and is provided as
|
|
|
185 |
* a convenience to customers using the generateSmtpPassword method. It is
|
|
|
186 |
* not recommended for use in production
|
|
|
187 |
*
|
|
|
188 |
* @link https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html#smtp-credentials-convert
|
|
|
189 |
*
|
|
|
190 |
* @param CredentialsInterface $creds
|
|
|
191 |
* @param string $region
|
|
|
192 |
*
|
|
|
193 |
* @return string
|
|
|
194 |
*/
|
|
|
195 |
public static function generateSmtpPasswordV4(CredentialsInterface $creds, $region)
|
|
|
196 |
{
|
|
|
197 |
$key = $creds->getSecretKey();
|
|
|
198 |
|
|
|
199 |
$date = "11111111";
|
|
|
200 |
$service = "ses";
|
|
|
201 |
$terminal = "aws4_request";
|
|
|
202 |
$message = "SendRawEmail";
|
|
|
203 |
$version = 0x04;
|
|
|
204 |
|
|
|
205 |
$signature = self::sign($date, "AWS4" . $key);
|
|
|
206 |
$signature = self::sign($region, $signature);
|
|
|
207 |
$signature = self::sign($service, $signature);
|
|
|
208 |
$signature = self::sign($terminal, $signature);
|
|
|
209 |
$signature = self::sign($message, $signature);
|
|
|
210 |
$signatureAndVersion = pack('c', $version) . $signature;
|
|
|
211 |
|
|
|
212 |
return base64_encode($signatureAndVersion);
|
|
|
213 |
}
|
|
|
214 |
|
|
|
215 |
private static function sign($key, $message) {
|
|
|
216 |
return hash_hmac('sha256', $key, $message, true);
|
|
|
217 |
}
|
|
|
218 |
|
|
|
219 |
/**
|
|
|
220 |
* @internal
|
|
|
221 |
* @codeCoverageIgnore
|
|
|
222 |
*/
|
|
|
223 |
public static function applyDocFilters(array $api, array $docs)
|
|
|
224 |
{
|
|
|
225 |
$b64 = '<div class="alert alert-info">This value will be base64 encoded on your behalf.</div>';
|
|
|
226 |
|
|
|
227 |
$docs['shapes']['RawMessage']['append'] = $b64;
|
|
|
228 |
|
|
|
229 |
return [
|
|
|
230 |
new Service($api, ApiProvider::defaultProvider()),
|
|
|
231 |
new DocModel($docs)
|
|
|
232 |
];
|
|
|
233 |
}
|
|
|
234 |
}
|