function forena_confirm_email_submit in Forena Reports 6.2
Same name and namespace in other branches
- 8 forena.common.inc \forena_confirm_email_submit()
- 6 forena.common.inc \forena_confirm_email_submit()
- 7.5 forena.common.inc \forena_confirm_email_submit()
- 7 forena.common.inc \forena_confirm_email_submit()
- 7.2 forena.common.inc \forena_confirm_email_submit()
- 7.3 forena.common.inc \forena_confirm_email_submit()
- 7.4 forena.common.inc \forena_confirm_email_submit()
File
- ./
forena.common.inc, line 425 - Common functions used throughout the project but loaded in this file to keep the module file lean.
Code
function forena_confirm_email_submit($form, &$form_state) {
global $user;
$test_send = $form_state['values']['send'] == 'test' ? TRUE : variable_get('forena_email_override', FALSE);
$max = (int) $form_state['values']['max'];
if (isset($form_state['values']['body'])) {
$body = check_markup($form_state['values']['body'], variable_get('forena_email_input_format', FILTER_FORMAT_DEFAULT), FALSE);
}
foreach ($form_state['storage']['docs'] as $doc) {
$to = $test_send ? $user->mail : $doc['to'];
if (isset($form_state['values']['body'])) {
$doc['parms']['body'] = $body;
}
if (isset($form_state['values']['subject'])) {
$doc['parms']['subject'] = $form_state['values']['subject'];
}
if ($test_send) {
$i++;
}
if ($i <= $max) {
drupal_mail('forena', 'mailmerge', $to, language_default(), $doc['parms'], $doc['from'], TRUE);
}
}
}