static function reset_form()
 {
     // Reset the current form to the defaults, but preserve the name
     check_admin_referer('fs_contact_options-options', 'fs_options');
     self::get_options();
     $form_name = self::$form_options['form_name'];
     self::$form_options = self::$form_defaults;
     self::$form_options['form_name'] = $form_name;
     update_option(self::$form_option_name, self::$form_options);
     echo '<div id="message" class="updated fade"><p>' . sprintf(__('Form %d has been reset to the default settings.', 'si-contact-form'), self::$current_form) . '</p></div>';
 }
    static function send_test_email()
    {
        // Send a test mail if necessary
        if (isset($_POST['si_contact_to']) && check_admin_referer('fs_contact_options-options', 'fs_options')) {
            // Send a test email
            // new lines should be (\n for UNIX, \r\n for Windows and \r for Mac)
            FSCF_Options::$form_options = FSCF_Util::get_form_options(FSCF_Options::$current_form, true);
            //			get_options();
            $php_eol = !defined('PHP_EOL') ? ($eol = strtolower(substr(PHP_OS, 0, 3))) == 'win' ? "\r\n" : ($eol == 'mac' ? "\r" : "\n") : PHP_EOL;
            $php_eol = !$php_eol ? "\n" : $php_eol;
            $email = $_POST['si_contact_to'];
            $name = __('Fast Secure Contact Form', 'si-contact-form');
            if (FSCF_Util::validate_email($email)) {
                $subject = __('Test email to ', 'si-contact-form') . $email;
                $message = __('This is a test email generated by the Fast Secure Contact Form WordPress plugin.', 'si-contact-form');
                $message = wordwrap($message, 70, $php_eol);
                $smtp_debug = '';
                $ctf_email_on_this_domain = FSCF_Options::$form_options['email_from'];
                // optional
                // prepare the email header
                self::$si_contact_from_name = $name;
                self::$si_contact_from_email = $email;
                //$si_contact_mail_sender = $ctf_email_on_this_domain;
                if ($ctf_email_on_this_domain != '') {
                    if (!preg_match("/,/", $ctf_email_on_this_domain)) {
                        // just an email: user1@example.com
                        $si_contact_mail_sender = $ctf_email_on_this_domain;
                        if (FSCF_Options::$form_options['email_from_enforced'] == 'true') {
                            self::$si_contact_from_email = $ctf_email_on_this_domain;
                        }
                    } else {
                        // name and email: webmaster,user1@example.com
                        list($key, $value) = explode(",", $ctf_email_on_this_domain);
                        $key = trim($key);
                        $value = trim($value);
                        $si_contact_mail_sender = $value;
                        if (FSCF_Options::$form_options['email_from_enforced'] == 'true') {
                            self::$si_contact_from_email = $value;
                        }
                    }
                }
                $header_php = 'From: ' . self::$si_contact_from_name . ' <' . self::$si_contact_from_email . '>\\n';
                // header for php mail only
                $header = '';
                // for php mail and wp_mail
                if (FSCF_Options::$form_options['email_reply_to'] != '') {
                    // custom reply_to
                    $header .= "Reply-To: " . FSCF_Options::$form_options['email_reply_to'] . "\n";
                } else {
                    $header .= "Reply-To: {$email}\n";
                }
                if ($ctf_email_on_this_domain != '') {
                    $header .= 'X-Sender: ' . $si_contact_mail_sender . "\n";
                    $header .= 'Return-Path: ' . $si_contact_mail_sender . "\n";
                }
                $header .= 'Content-type: text/plain; charset=' . get_option('blog_charset') . $php_eol;
                @ini_set('sendmail_from', self::$si_contact_from_email);
                // Check for safe mode
                $safe_mode = (bool) @ini_get('safe_mode') === false ? 0 : 1;
                if (FSCF_Options::$form_options['php_mailer_enable'] == 'php') {
                    // sending with php mail
                    $header_php .= $header;
                    // Start output buffering to grab smtp debugging output
                    ob_start();
                    if ($ctf_email_on_this_domain != '' && !$safe_mode) {
                        // Pass the Return-Path via sendmail's -f command.
                        $result = mail($email, $subject, $message, $header_php, '-f ' . $si_contact_mail_sender);
                    } else {
                        // the fifth parameter is not allowed in safe mode
                        $result = mail($email, $subject, $message, $header_php);
                    }
                    $smtp_debug = ob_get_clean();
                } else {
                    if (FSCF_Options::$form_options['php_mailer_enable'] == 'wordpress') {
                        // sending with wp_mail
                        add_filter('wp_mail_from', 'FSCF_Action::si_contact_form_from_email', 1);
                        // took out _form
                        add_filter('wp_mail_from_name', 'FSCF_Action::si_contact_form_from_name', 1);
                        // took out _form
                        if ($ctf_email_on_this_domain != '') {
                            // Add an action on phpmailer_init to add Sender $this->si_contact_mail_sender for Return-path in wp_mail
                            // this helps spf checking when the Sender email address matches the site domain name
                            add_action('phpmailer_init', 'FSCF_Action::si_contact_form_mail_sender', 1);
                        }
                        global $phpmailer;
                        // Make sure the PHPMailer class has been instantiated
                        // (copied verbatim from wp-includes/pluggable.php)
                        // (Re)create it, if it's gone missing
                        if (!is_object($phpmailer) || !is_a($phpmailer, 'PHPMailer')) {
                            require_once ABSPATH . WPINC . '/class-phpmailer.php';
                            require_once ABSPATH . WPINC . '/class-smtp.php';
                            $phpmailer = new PHPMailer();
                        }
                        // Set SMTPDebug to level 2
                        $phpmailer->SMTPDebug = 2;
                        // Start output buffering to grab smtp debugging output
                        ob_start();
                        // Send the test mail
                        $result = wp_mail($email, $subject, $message, $header);
                        // Grab the smtp debugging output
                        $smtp_debug = ob_get_clean();
                    }
                }
                // Output the response
                ?>
				<div id="message" class="updated"><p><strong><?php 
                _e('Test Message Sent', 'si-contact-form');
                echo '<br />' . FSCF_Options::$form_options['php_mailer_enable'];
                echo ' ' . $subject;
                ?>
</strong></p>
				<?php 
                if ($result != true) {
                    ?>
					<p><?php 
                    _e('The result was:', 'si-contact-form');
                    ?>
</p>
					<?php 
                    echo '<p><a href="http://www.fastsecurecontactform.com/email-does-not-send">' . __('See FAQ', 'si-contact-form') . '</a></p>';
                    ?>
					<pre><?php 
                    esc_html(var_dump($result));
                    ?>
</pre>
					<?php 
                    if (FSCF_Options::$form_options['php_mailer_enable'] == 'wordpress') {
                        ?>
						<p><?php 
                        _e('The full debugging output is shown below:', 'si-contact-form');
                        ?>
</p>
						<?php 
                        echo '<p><a href="http://www.fastsecurecontactform.com/email-does-not-send">' . __('See FAQ', 'si-contact-form') . '</a></p>';
                        ?>
						<pre><?php 
                        esc_html(var_dump($phpmailer));
                        ?>
</pre>
						<?php 
                    }
                } else {
                    echo '<p>' . _e('Be sure to check your email to see if you received it.', 'si-contact-form') . '</p>';
                    echo '<p><a href="http://www.fastsecurecontactform.com/email-does-not-send">' . __('See FAQ', 'si-contact-form') . '</a></p>';
                }
                if ($smtp_debug != '') {
                    ?>
					<p><?php 
                    _e('The Email debugging output is shown below:', 'si-contact-form');
                    ?>
</p>
					<?php 
                    echo '<p><a href="http://www.fastsecurecontactform.com/email-does-not-send">' . __('See FAQ', 'si-contact-form') . '</a></p>';
                    ?>
					<pre><?php 
                    echo esc_html($smtp_debug);
                    ?>
</pre>
					<?php 
                }
            } else {
                echo '<div id="message" class="updated"><p><strong>' . __('Test failed: Invalid email address', 'si-contact-form') . '</strong></p>';
            }
            ?>
			</div>
			<?php 
        }
        // end Send a test mail if necessary
    }