$smarty->assign('vMsg', $vMsg);
} else {
    // ___ USER HAS SENT FORM ___
    SmartyValidate::connect($smarty);
    if (SmartyValidate::is_valid($_POST) && !$current) {
        // __ FORM IS VALID
        Pommo::requireOnce($pommo->_baseDir . 'inc/classes/mailctl.php');
        Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/subscribers.php');
        Pommo::requireOnce($pommo->_baseDir . 'inc/helpers/validate.php');
        // get a copy of the message state
        // composition is valid (via preview.php)
        $state = $pommo->_session['state']['mailing'];
        // create temp subscriber
        $subscriber = array('email' => $_POST['email'], 'registered' => time(), 'ip' => $_SERVER['REMOTE_ADDR'], 'status' => 0, 'data' => $_POST['d']);
        PommoValidate::subscriberData($subscriber['data'], array('active' => FALSE, 'ignore' => TRUE, 'log' => false));
        $key = PommoSubscriber::add($subscriber);
        if (!$key) {
            $logger->addErr('Unable to Add Subscriber');
        } else {
            // temp subscriber created
            $state['tally'] = 1;
            $state['group'] = Pommo::_T('Test Mailing');
            if ($state['ishtml'] == 'off') {
                $state['body'] = $state['altbody'];
                $state['altbody'] = '';
            }
            // create mailing
            $mailing = PommoMailing::make(array(), TRUE);
            $state['status'] = 1;
            $state['current_status'] = 'stopped';
            $state['command'] = 'restart';
        } elseif ($fid == 'email' && PommoHelper::isEmail($col)) {
            $subscriber['email'] = $col;
        } elseif ($fid == 'registered') {
            $subscriber['registered'] = PommoHelper::timeFromStr($col);
        } elseif ($fid == 'ip') {
            $subscriber['ip'] = $col;
        }
    }
    if ($subscriber['email']) {
        // check for dupe
        // TODO -- DO THIS IN BATCH ??
        if (PommoHelper::isDupe($subscriber['email'], $includeUnsubscribed)) {
            $dupes++;
            continue;
        }
        // validate/fix data
        if (!PommoValidate::subscriberData($subscriber['data'], array('log' => false, 'ignore' => true, 'active' => false))) {
            $subscriber['flag'] = 9;
        }
        // add subscriber
        if (PommoSubscriber::add($subscriber)) {
            $tally++;
            if (isset($subscriber['flag'])) {
                $flagged++;
            }
        }
    }
}
unlink($pommo->_workDir . '/import.csv');
echo '<div class="warn"><p>' . sprintf(Pommo::_T('%s subscribers imported! Of these, %s were flagged to update their records.'), $tally, $flagged) . '<p>' . sprintf(Pommo::_T('%s duplicates encountered.'), $dupes) . '</p></div>';
die(Pommo::_T('Complete!') . ' <a href="subscribers_import.php">' . Pommo::_T('Return to') . ' ' . Pommo::_T('Import') . '</a>');