public static function sendTestEmail()
 {
     $to = $_POST['email'];
     $status = $_POST['status'];
     if (!Cart66Common::isValidEmail($to)) {
         $result[0] = 'Cart66Modal alert-message alert-error';
         $result[1] = '<strong>Error</strong><br/>' . __('Please enter a valid email address', 'cart66') . '<br>';
     } else {
         if (isset($_GET['type']) && $_GET['type'] == 'reminder') {
             $sendEmail = Cart66MembershipReminders::sendTestReminderEmails($to, $_GET['id']);
         } else {
             $sendEmail = Cart66AdvancedNotifications::sendTestEmail($to, $status);
         }
         if ($sendEmail) {
             $result[0] = 'Cart66Modal alert-message success';
             $result[1] = '<strong>Success</strong><br/>' . __('Email successfully sent to', 'cart66') . ' <br /><strong>' . $to . '</strong><br>';
         } else {
             $result[0] = 'Cart66Modal alert-message alert-error';
             $result[1] = '<strong>Error</strong><br/>' . __('Email not sent. There is an unknown error.', 'cart66') . '<br>';
         }
     }
     echo json_encode($result);
     die;
 }
                    <?php 
        }
        ?>
                  </p>
                </th>
                <td></td>
              </tr>
              <tr valign="top">
                <th scope="row"></th>
                <td></td>
              </tr>
            </tbody>
          </table>
        </form>
        <?php 
        $rem = new Cart66MembershipReminders();
        if (count($rem->getModels()) > 0) {
            ?>
          <table class="widefat Cart66HighlightTable" id="subscription_reminders_table">
            <thead>
              <tr>
                <th><?php 
            _e('Subscription', 'cart66');
            ?>
</th>
                <th><?php 
            _e('Active', 'cart66');
            ?>
</th>
                <th><?php 
            _e('Interval', 'cart66');
 public function section_debug_settings()
 {
     $tab = 'debug-error_logging';
     if (isset($_GET['cart66_curl_test']) && $_GET['cart66_curl_test'] == 'run' || isset($_POST['cart66-action']) && $_POST['cart66-action'] == 'clear log file') {
         $tab = 'debug-debug_data';
     } elseif (isset($_POST['cart66-action']) && $_POST['cart66-action'] == 'check subscription reminders') {
         Cart66MembershipReminders::dailySubscriptionEmailReminderCheck();
         $tab = 'debug-debug_data';
     } elseif (isset($_POST['cart66-action']) && $_POST['cart66-action'] == 'check followup emails') {
         Cart66AdvancedNotifications::dailyFollowupEmailCheck();
         $tab = 'debug-debug_data';
     } elseif (isset($_POST['cart66-action']) && $_POST['cart66-action'] == 'prune pending orders') {
         $order = new Cart66Order();
         $order->dailyPrunePendingPayPalOrders();
         $tab = 'debug-debug_data';
     } elseif (isset($_GET['sessions']) && $_GET['sessions'] == 'repair') {
         $tab = 'debug-session_settings';
     }
     $data = array('tab' => $tab);
     echo Cart66Common::getView('admin/settings/debug.php', $data, false);
 }
 public static function sendTestReminderEmails($to_email, $reminderId)
 {
     $isSent = false;
     $notify = new Cart66AdvancedNotifications();
     $reminder = new Cart66MembershipReminders($reminderId);
     $from_email = $reminder->from_email;
     $from_name = $reminder->from_name;
     $head = $notify->buildEmailHeader($from_name, $from_email);
     $email_data = array('from_email' => $from_email, 'from_name' => $from_name, 'to_email' => $to_email, 'to_name' => '', 'copy_to' => '', 'head' => $head, 'subject' => $reminder->subject, 'msg' => $reminder->getReminderEmailMessage(null, $head['mime'], 'test'), 'attachments' => null, 'order_id' => '', 'email_type' => 'TEST', 'log' => 'test_emails', 'status' => 'test');
     if ($reminder) {
         $isSent = $notify->sendEmail($email_data);
     }
     return $isSent;
 }