You are here

function amazon_ses_get_mail_statistics_form in Amazon SES 7.2

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

Display Sending Quota and Statistics data.

@todo Sendign Quota and statistics should be displayed to user in better GUI and user of graph.

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

File

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

Code

function amazon_ses_get_mail_statistics_form($form, $form_state) {
  $result_quota = amazon_ses_send_request('GetSendQuota', array());
  if ($result_quota['error']) {
    amazon_ses_set_error_message('GetSendQuota', $result);
    return '';
  }
  $form['sending_limits_fieldset'] = array(
    '#type' => 'fieldset',
    '#title' => t('Your Amazon SES Sending Limits'),
    '#collapsed' => FALSE,
  );
  $form['sending_limits_fieldset']['sending_limit_data'] = array(
    '#prefix' => t('<strong>Sending Quota:</strong> Send @max_send emails per 24
    hour period.', array(
      '@max_send' => $result_quota['Max24HourSend'],
    )) . '<br/>' . t('<strong>Sent Mail in Last 24 hours:</strong> @sent_last', array(
      '@sent_last' => $result_quota['SentLast24Hours'],
    )) . '<br/>' . t('<strong>Max Send Rate:</strong> @send_rate Email/second.', array(
      '@send_rate' => $result_quota['MaxSendRate'],
    )),
  );
  $result_statistics = amazon_ses_send_request('GetSendStatistics', array());
  if ($result_statistics['error']) {
    amazon_ses_set_error_message('GetSendStatistics', $result);
    return '';
  }
  $form['sending_statistics_fieldset'] = array(
    '#type' => 'fieldset',
    '#title' => t('Your Amazon SES Metrics'),
    '#collapsed' => FALSE,
  );
  $form['sending_statistics_fieldset']['sending_statistics_data'] = array(
    '#prefix' => t('<strong>Total number of mails sent:</strong> @delivery_attempts
    in last two weeks.', array(
      '@delivery_attempts' => $result_statistics['DeliveryAttempts'],
    )) . '<br/>' . t('<strong>Total number of Bounces Mail:</strong> @bounces in
    last two weeks.', array(
      '@bounces' => $result_statistics['Bounces'],
    )) . '<br/>' . t('<strong>Total number of Complaints mail:</strong> @complaints
    in last two weeks.', array(
      '@complaints' => $result_statistics['Complaints'],
    )) . '<br/>' . t('<strong>Total number of Rejected mail:</strong> @rejects in last two
    weeks.', array(
      '@rejects' => $result_statistics['Rejects'],
    )) . '<br/>',
  );
  return $form;
}