You are here

function amazon_ses_identity_list_update in Amazon SES 7.2

Same name and namespace in other branches
  1. 7 includes/amazon_ses.admin.inc \amazon_ses_identity_list_update()

Send request to amazon ses api to delete sender's identities.

1 string reference to 'amazon_ses_identity_list_update'
amazon_ses_identity_list_form in includes/amazon_ses.admin.inc
Display Verified Sender Identites to Admin.

File

includes/amazon_ses.admin.inc, line 356
Administration menu callbacks for amazon_mail_service.

Code

function amazon_ses_identity_list_update($form, &$form_state) {
  $selected_identities = array_filter($form_state['values']['list_table']);

  // @todo Amazon SES api throtteled request per second. Here we are sending
  // request in loop which may cause problem. so will add sleep for 1 sec.
  foreach ($selected_identities as $value) {
    $action_parameter['identity'] = $form_state['complete form']['amazon_list_identities_update']['list_table']['#options'][$value]['Identity'];

    // This request is throttled per second.
    $result = amazon_ses_send_request('DeleteIdentity', $action_parameter);

    // Display the response of calling of Amazon SES API.
    if (isset($result['error'])) {
      amazon_ses_set_error_message('DeleteIdentity', $result);
    }
    else {
      $message = t('Identity @identity is deleted successfully from Amazon SES.', array(
        '@identity' => $action_parameter['identity'],
      ));
      drupal_set_message($message, 'status');
    }
  }
}