function protected_pages_send_email_submit in Protected Pages 7
Same name and namespace in other branches
- 7.2 protected_pages.admin.inc \protected_pages_send_email_submit()
Implements hook_submit().
File
- ./
protected_pages.admin.inc, line 347 - Provides page callbacks for configuration page.
Code
function protected_pages_send_email_submit($form, &$form_state) {
$path = db_select('protected_pages')
->fields('protected_pages', array(
'path',
))
->condition('pid', $form_state['pid'])
->range(0, 1)
->execute()
->fetchField();
$module = 'protected_pages';
$key = 'protected_pages_details_mail';
$to = $form_state['values']['recipents'];
$from = variable_get('site_mail');
$language = language_default();
$send = TRUE;
$params = array();
$params['subject'] = $form_state['values']['subject'];
$params['body'] = $form_state['values']['body'];
$params['protected_page_url'] = url($path, array(
'absolute' => TRUE,
));
drupal_mail($module, $key, $to, $language, $params, $from, $send);
drupal_set_message(t('The email has been successfully sent.'));
$form_state['redirect'] = 'admin/config/system/protected_pages';
}