{*
 Шаблон вычисления "Отправить шаблон рассылки"
*}

global $thread{$send_tpl}, $sended;
if (!$thread{$send_tpl}) {
    $thread{$send_tpl} = send_template({$send_tpl}, 'id = ' . $line['id']);
    $sended = 1;
} else {
    form_mail_template($thread{$send_tpl}, 'id = ' . $line['id']);
    $sended++;
}
if (!isset($_REQUEST['sel']) || $sended == count_cb($_REQUEST['sel'])) {
    if ($sended <= $config['instant_send_count']) {
        send_all_mail($thread{$send_tpl});
    }
    $_SESSION[$ses_id]['send_mode'] = 'send';
    $_SESSION[$ses_id]['send_complit'] = 1;
}