You are here

function forena_confirm_email_submit in Forena Reports 7

Same name and namespace in other branches
  1. 8 forena.common.inc \forena_confirm_email_submit()
  2. 6.2 forena.common.inc \forena_confirm_email_submit()
  3. 6 forena.common.inc \forena_confirm_email_submit()
  4. 7.5 forena.common.inc \forena_confirm_email_submit()
  5. 7.2 forena.common.inc \forena_confirm_email_submit()
  6. 7.3 forena.common.inc \forena_confirm_email_submit()
  7. 7.4 forena.common.inc \forena_confirm_email_submit()

File

./forena.common.inc, line 979
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'];
  $i = 0;
  foreach ($form_state['storage']['docs'] as $doc) {
    $to = $test_send ? $user->mail : $doc['to'];
    $from = $doc['from'];
    if ($test_send) {
      $i++;
    }
    if ($i <= $max) {
      drupal_mail('forena', 'mailmerge', $to, language_default(), $doc['parms'], $from, TRUE);
    }
  }
}