You are here

private function AmazonSesClass::getIdentityDkimAttributes in Amazon SES 7

Call Query API action GetIdentityNotificationAttributes.

This action is throttled at one request per second.

1 call to AmazonSesClass::getIdentityDkimAttributes()
AmazonSesClass::performServiceAction in includes/classes/amazonses.class.php
Add required parameter & header to the Query according to Query action.

File

includes/classes/amazonses.class.php, line 102
Class for interacting with Amazon SES service.

Class

AmazonSesClass
Modify the drupal mail system to use Amazon SES.

Code

private function getIdentityDkimAttributes($action_parameter) {
  $response_xml = $this->sesClient
    ->get_identity_dkim_attributes($action_parameter['Identities']);

  // Parse xml response.
  $response = $response_xml->body
    ->to_stdClass();
  if ($response_xml->status == '200') {
    $entry = $response->GetIdentityDkimAttributesResult->DkimAttributes->entry;
    $result['key'] = check_plain($entry->key);
    $result['DkimEnabled'] = check_plain($entry->value->DkimEnabled);
    $result['DkimVerificationStatus'] = check_plain($entry->value->DkimVerificationStatus);
    $dkim_tokens = $entry->value->DkimTokens->member;
    $i = 0;
    if (strpos($result['key'], '@') != FALSE) {
      $temp_arr = explode('@', $result['key']);
      $domain = $temp_arr[1];
    }
    else {
      $domain = $result['key'];
    }
    foreach ($dkim_tokens as $token) {
      $name = (string) $token . '._domainkey.' . $domain;
      $value = (string) $token . '.dkim.amazonses.com';
      $result['member']['row' . $i]['name'] = check_plain($name);
      $result['member']['row' . $i]['value'] = check_plain($value);
      $result['member']['row' . $i]['type'] = 'CNAME';
      $i++;
    }
    $result['status'] = AMAZON_SES_REQUEST_SUCCESS;
  }
  else {
    $result['status'] = AMAZON_SES_REQUEST_FALIURE;
  }
  return $result;
}