コード例 #1
0
 public static function check_smtp()
 {
     $options = new RM_Options();
     $bckup = $options->get_all_options();
     $email = isset($_POST['test_email']) ? $_POST['test_email'] : null;
     $options->set_values(array('enable_smtp' => 'yes', 'smtp_host' => isset($_POST['smtp_host']) ? $_POST['smtp_host'] : null, 'smtp_auth' => isset($_POST['SMTPAuth']) ? $_POST['SMTPAuth'] : null, 'smtp_port' => isset($_POST['Port']) ? $_POST['Port'] : null, 'smtp_user_name' => isset($_POST['Username']) ? $_POST['Username'] : null, 'smtp_password' => isset($_POST['Password']) ? $_POST['Password'] : null, 'smtp_encryption_type' => isset($_POST['SMTPSecure']) ? $_POST['SMTPSecure'] : null, 'senders_email' => isset($_POST['From']) ? $_POST['From'] : null, 'senders_display_name' => isset($_POST['FromName']) ? $_POST['FromName'] : null));
     if (!$email) {
         echo RM_UI_Strings::get('LABEL_FAILED');
         $options->set_values($bckup);
         die;
     }
     if (wp_mail($email, 'Test SMTP Connection', 'Test')) {
         echo RM_UI_Strings::get('LABEL_SUCCESS');
     } else {
         echo RM_UI_Strings::get('LABEL_FAILED');
     }
     $options->set_values($bckup);
     die;
 }