You are here

function _prod_check_mimemail in Production check & Production monitor 6

Same name and namespace in other branches
  1. 7 prod_check.module \_prod_check_mimemail()

File

./prod_check.module, line 1599

Code

function _prod_check_mimemail($caller = 'internal') {
  if (!module_exists('mimemail')) {
    return;
  }
  $check = array();
  $title = 'Mimemail';
  $path = 'admin/settings/mimemail';
  if ($caller != 'internal') {
    $path = PRODCHECK_BASEURL . $path;
  }
  $mimemail_mail = variable_get('mimemail_mail', variable_get('site_mail', ini_get('sendmail_from')));
  $arguments = array(
    '!mimemail' => $title,
    '%mail' => $mimemail_mail,
  );
  $check['prod_check_mimemail'] = array(
    '#title' => t($title),
    '#state' => $mimemail_mail != '' && !preg_match('/' . preg_quote(variable_get('prod_check_sitemail', '')) . '/i', $mimemail_mail),
    '#severity' => $caller == 'nagios' ? NAGIOS_STATUS_CRITICAL : PROD_CHECK_REQUIREMENT_ERROR,
    '#value_ok' => t('!mimemail default sender e-mail address OK: %mail', $arguments),
    '#value_nok' => t('!mimemail default sender e-mail address set to %mail', $arguments),
    '#description_ok' => prod_check_ok_title($title, $path),
    '#description_nok' => t('The !link default from e-mail address should not be a development address on production sites!', prod_check_link_array($title, $path)),
    '#nagios_key' => 'MIML',
    '#nagios_type' => 'state',
  );
  return prod_check_execute_check($check, $caller);
}