You are here

function amazon_ses_domain_dkim_enable_form in Amazon SES 7.2

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

Form for Enablling DKIM for sender's Identity.

1 string reference to 'amazon_ses_domain_dkim_enable_form'
amazon_ses_menu in ./amazon_ses.module
Implements hook_menu().

File

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

Code

function amazon_ses_domain_dkim_enable_form($form, &$form_state) {

  // Set default identity type to Domain.
  $identity_type = 'Domain';
  if (isset($form_state['values']['select_indentity'])) {
    $identity_type = $form_state['values']['select_indentity'];
  }

  // Reterieve identity list by sending request to amazon SES API.
  $form = amazon_ses_get_identity_list($identity_type);
  if (isset($form['exception'])) {
    return '';
  }
  $form['amazon_list_identities_filter']['select_indentity']['#default_value'] = array(
    $identity_type,
  );
  $form['amazon_list_identities_update']['select_update'] = array(
    '#type' => 'select',
    '#title' => '',
    '#options' => array(
      'DkimAttributes' => t('Get CNAME record'),
    ),
  );
  $form['amazon_list_identities_update']['update'] = array(
    '#type' => 'button',
    '#value' => t('Send Request'),
  );
  $form['amazon_list_identities_update']['#title'] = t('DKIM Settings');
  $form['amazon_list_identities_update']['#description'] = t('DomainKeys
    Identified Mail (DKIM) is a standard that allows senders to sign their email
    messages and ISPs to use those signatures to verify that those messages are
    legitimate and have not been modified by a third party in transit.') . '<br/>' . t("To set up DKIM, you must update your domain's DNS settings with\n    the CNAME record information. For obtaining CNAME record select Domain or\n    Email addrees then click on <strong>Send Request</strong>.") . '<br/>';
  $form['amazon_list_identities_update']['list_table']['#multiple'] = FALSE;
  $form['amazon_list_identities_update']['list_table']['#input'] = FALSE;
  $form['amazon_list_identities_update']['update']['#ajax'] = array(
    'callback' => 'amazon_ses_domain_dkim_enable_callback',
    'wrapper' => 'domain-dkim-wrapper',
    'effect' => 'fade',
    'method' => 'html',
  );

  // Form component showing DKIM records.
  $header = array(
    'name' => t('Name'),
    'type' => t('Type'),
    'value' => t('Value'),
  );
  $form['div'] = array(
    '#prefix' => '<div id = "domain-dkim-wrapper">',
    '#suffix' => '</div>',
  );
  $form['div']['domain_dkim_info'] = array(
    '#prefix' => '',
    '#suffix' => '',
  );
  $form['div']['domain_dkim_token_table'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => NULL,
    '#empty' => t('No content available.'),
    '#access' => FALSE,
  );
  return $form;
}