You are here

function mailgun_test_form in Mailgun 7

Form builder. Display a form for sending a test e-mail.

1 string reference to 'mailgun_test_form'
mailgun_menu in ./mailgun.module
Implements hook_menu().

File

./mailgun.admin.inc, line 234
Administration page callbacks for Mailgun.

Code

function mailgun_test_form($form, &$form_state) {
  drupal_set_title(t('Send test mail'));
  $form['to'] = array(
    '#type' => 'textfield',
    '#title' => t('To'),
    '#default_value' => variable_get('site_mail', ''),
    '#description' => t('Type in an address to have the test email sent there.'),
    '#required' => TRUE,
  );
  $message = "Howdy!\n\nIf this e-mail is displayed correctly and delivered sound and safe, congrats! You have successfully configured Mailgun. ";
  $message .= t('Visit the !project to contribute or read !documentation to learn more.', array(
    '!project' => l(t('project page'), 'https://www.drupal.org/project/mailgun'),
    '!documentation' => l(t('documentation'), MAILGUN_DOCUMENTATION_LINK),
  ));
  $form['message'] = array(
    '#type' => 'textarea',
    '#title' => t('Message'),
    '#default_value' => $message,
    '#required' => TRUE,
  );
  $form['attachment'] = array(
    '#title' => t('Include attachment'),
    '#type' => 'checkbox',
    '#description' => t('If checked, the Drupal icon will be included as an attachment with the test e-mail.'),
    '#default_value' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Send'),
  );
  $form['cancel'] = array(
    '#type' => 'link',
    '#href' => MAILGUN_ADMIN_PAGE,
    '#title' => t('Cancel'),
  );
  return $form;
}