SesClient.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. namespace Aws\Ses;
  3. use Aws\Credentials\CredentialsInterface;
  4. /**
  5. * This client is used to interact with the **Amazon Simple Email Service (Amazon SES)**.
  6. *
  7. * @method \Aws\Result cloneReceiptRuleSet(array $args = [])
  8. * @method \GuzzleHttp\Promise\Promise cloneReceiptRuleSetAsync(array $args = [])
  9. * @method \Aws\Result createConfigurationSet(array $args = [])
  10. * @method \GuzzleHttp\Promise\Promise createConfigurationSetAsync(array $args = [])
  11. * @method \Aws\Result createConfigurationSetEventDestination(array $args = [])
  12. * @method \GuzzleHttp\Promise\Promise createConfigurationSetEventDestinationAsync(array $args = [])
  13. * @method \Aws\Result createReceiptFilter(array $args = [])
  14. * @method \GuzzleHttp\Promise\Promise createReceiptFilterAsync(array $args = [])
  15. * @method \Aws\Result createReceiptRule(array $args = [])
  16. * @method \GuzzleHttp\Promise\Promise createReceiptRuleAsync(array $args = [])
  17. * @method \Aws\Result createReceiptRuleSet(array $args = [])
  18. * @method \GuzzleHttp\Promise\Promise createReceiptRuleSetAsync(array $args = [])
  19. * @method \Aws\Result deleteConfigurationSet(array $args = [])
  20. * @method \GuzzleHttp\Promise\Promise deleteConfigurationSetAsync(array $args = [])
  21. * @method \Aws\Result deleteConfigurationSetEventDestination(array $args = [])
  22. * @method \GuzzleHttp\Promise\Promise deleteConfigurationSetEventDestinationAsync(array $args = [])
  23. * @method \Aws\Result deleteIdentity(array $args = [])
  24. * @method \GuzzleHttp\Promise\Promise deleteIdentityAsync(array $args = [])
  25. * @method \Aws\Result deleteIdentityPolicy(array $args = [])
  26. * @method \GuzzleHttp\Promise\Promise deleteIdentityPolicyAsync(array $args = [])
  27. * @method \Aws\Result deleteReceiptFilter(array $args = [])
  28. * @method \GuzzleHttp\Promise\Promise deleteReceiptFilterAsync(array $args = [])
  29. * @method \Aws\Result deleteReceiptRule(array $args = [])
  30. * @method \GuzzleHttp\Promise\Promise deleteReceiptRuleAsync(array $args = [])
  31. * @method \Aws\Result deleteReceiptRuleSet(array $args = [])
  32. * @method \GuzzleHttp\Promise\Promise deleteReceiptRuleSetAsync(array $args = [])
  33. * @method \Aws\Result deleteVerifiedEmailAddress(array $args = [])
  34. * @method \GuzzleHttp\Promise\Promise deleteVerifiedEmailAddressAsync(array $args = [])
  35. * @method \Aws\Result describeActiveReceiptRuleSet(array $args = [])
  36. * @method \GuzzleHttp\Promise\Promise describeActiveReceiptRuleSetAsync(array $args = [])
  37. * @method \Aws\Result describeConfigurationSet(array $args = [])
  38. * @method \GuzzleHttp\Promise\Promise describeConfigurationSetAsync(array $args = [])
  39. * @method \Aws\Result describeReceiptRule(array $args = [])
  40. * @method \GuzzleHttp\Promise\Promise describeReceiptRuleAsync(array $args = [])
  41. * @method \Aws\Result describeReceiptRuleSet(array $args = [])
  42. * @method \GuzzleHttp\Promise\Promise describeReceiptRuleSetAsync(array $args = [])
  43. * @method \Aws\Result getIdentityDkimAttributes(array $args = [])
  44. * @method \GuzzleHttp\Promise\Promise getIdentityDkimAttributesAsync(array $args = [])
  45. * @method \Aws\Result getIdentityMailFromDomainAttributes(array $args = [])
  46. * @method \GuzzleHttp\Promise\Promise getIdentityMailFromDomainAttributesAsync(array $args = [])
  47. * @method \Aws\Result getIdentityNotificationAttributes(array $args = [])
  48. * @method \GuzzleHttp\Promise\Promise getIdentityNotificationAttributesAsync(array $args = [])
  49. * @method \Aws\Result getIdentityPolicies(array $args = [])
  50. * @method \GuzzleHttp\Promise\Promise getIdentityPoliciesAsync(array $args = [])
  51. * @method \Aws\Result getIdentityVerificationAttributes(array $args = [])
  52. * @method \GuzzleHttp\Promise\Promise getIdentityVerificationAttributesAsync(array $args = [])
  53. * @method \Aws\Result getSendQuota(array $args = [])
  54. * @method \GuzzleHttp\Promise\Promise getSendQuotaAsync(array $args = [])
  55. * @method \Aws\Result getSendStatistics(array $args = [])
  56. * @method \GuzzleHttp\Promise\Promise getSendStatisticsAsync(array $args = [])
  57. * @method \Aws\Result listConfigurationSets(array $args = [])
  58. * @method \GuzzleHttp\Promise\Promise listConfigurationSetsAsync(array $args = [])
  59. * @method \Aws\Result listIdentities(array $args = [])
  60. * @method \GuzzleHttp\Promise\Promise listIdentitiesAsync(array $args = [])
  61. * @method \Aws\Result listIdentityPolicies(array $args = [])
  62. * @method \GuzzleHttp\Promise\Promise listIdentityPoliciesAsync(array $args = [])
  63. * @method \Aws\Result listReceiptFilters(array $args = [])
  64. * @method \GuzzleHttp\Promise\Promise listReceiptFiltersAsync(array $args = [])
  65. * @method \Aws\Result listReceiptRuleSets(array $args = [])
  66. * @method \GuzzleHttp\Promise\Promise listReceiptRuleSetsAsync(array $args = [])
  67. * @method \Aws\Result listVerifiedEmailAddresses(array $args = [])
  68. * @method \GuzzleHttp\Promise\Promise listVerifiedEmailAddressesAsync(array $args = [])
  69. * @method \Aws\Result putIdentityPolicy(array $args = [])
  70. * @method \GuzzleHttp\Promise\Promise putIdentityPolicyAsync(array $args = [])
  71. * @method \Aws\Result reorderReceiptRuleSet(array $args = [])
  72. * @method \GuzzleHttp\Promise\Promise reorderReceiptRuleSetAsync(array $args = [])
  73. * @method \Aws\Result sendBounce(array $args = [])
  74. * @method \GuzzleHttp\Promise\Promise sendBounceAsync(array $args = [])
  75. * @method \Aws\Result sendEmail(array $args = [])
  76. * @method \GuzzleHttp\Promise\Promise sendEmailAsync(array $args = [])
  77. * @method \Aws\Result sendRawEmail(array $args = [])
  78. * @method \GuzzleHttp\Promise\Promise sendRawEmailAsync(array $args = [])
  79. * @method \Aws\Result setActiveReceiptRuleSet(array $args = [])
  80. * @method \GuzzleHttp\Promise\Promise setActiveReceiptRuleSetAsync(array $args = [])
  81. * @method \Aws\Result setIdentityDkimEnabled(array $args = [])
  82. * @method \GuzzleHttp\Promise\Promise setIdentityDkimEnabledAsync(array $args = [])
  83. * @method \Aws\Result setIdentityFeedbackForwardingEnabled(array $args = [])
  84. * @method \GuzzleHttp\Promise\Promise setIdentityFeedbackForwardingEnabledAsync(array $args = [])
  85. * @method \Aws\Result setIdentityHeadersInNotificationsEnabled(array $args = [])
  86. * @method \GuzzleHttp\Promise\Promise setIdentityHeadersInNotificationsEnabledAsync(array $args = [])
  87. * @method \Aws\Result setIdentityMailFromDomain(array $args = [])
  88. * @method \GuzzleHttp\Promise\Promise setIdentityMailFromDomainAsync(array $args = [])
  89. * @method \Aws\Result setIdentityNotificationTopic(array $args = [])
  90. * @method \GuzzleHttp\Promise\Promise setIdentityNotificationTopicAsync(array $args = [])
  91. * @method \Aws\Result setReceiptRulePosition(array $args = [])
  92. * @method \GuzzleHttp\Promise\Promise setReceiptRulePositionAsync(array $args = [])
  93. * @method \Aws\Result updateConfigurationSetEventDestination(array $args = [])
  94. * @method \GuzzleHttp\Promise\Promise updateConfigurationSetEventDestinationAsync(array $args = [])
  95. * @method \Aws\Result updateReceiptRule(array $args = [])
  96. * @method \GuzzleHttp\Promise\Promise updateReceiptRuleAsync(array $args = [])
  97. * @method \Aws\Result verifyDomainDkim(array $args = [])
  98. * @method \GuzzleHttp\Promise\Promise verifyDomainDkimAsync(array $args = [])
  99. * @method \Aws\Result verifyDomainIdentity(array $args = [])
  100. * @method \GuzzleHttp\Promise\Promise verifyDomainIdentityAsync(array $args = [])
  101. * @method \Aws\Result verifyEmailAddress(array $args = [])
  102. * @method \GuzzleHttp\Promise\Promise verifyEmailAddressAsync(array $args = [])
  103. * @method \Aws\Result verifyEmailIdentity(array $args = [])
  104. * @method \GuzzleHttp\Promise\Promise verifyEmailIdentityAsync(array $args = [])
  105. */
  106. class SesClient extends \Aws\AwsClient
  107. {
  108. /**
  109. * Create an SMTP password for a given IAM user's credentials.
  110. *
  111. * The SMTP username is the Access Key ID for the provided credentials.
  112. *
  113. * @link http://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html#smtp-credentials-convert
  114. *
  115. * @param CredentialsInterface $creds
  116. *
  117. * @return string
  118. */
  119. public static function generateSmtpPassword(CredentialsInterface $creds)
  120. {
  121. static $version = "\x02";
  122. static $algo = 'sha256';
  123. static $message = 'SendRawEmail';
  124. $signature = hash_hmac($algo, $message, $creds->getSecretKey(), true);
  125. return base64_encode($version . $signature);
  126. }
  127. }