Cockpit\Controller\Settings::test PHP Method

test() public method

public test ( $case )
    public function test($case)
    {
        switch ($case) {
            case 'email':
                $email = $this->param("email", false);
                if ($email) {
                    try {
                        $ret = $this->app->mailer->mail($email, "Test Email", "It seems your Server can send Emails with the current mailer settings.", [], true);
                        // Catch phpmailerException
                    } catch (\Exception $e) {
                        return json_encode(['status' => false, 'exception' => $e->getMessage()]);
                    }
                } else {
                    $ret = false;
                }
                return json_encode(["status" => $ret]);
                break;
        }
        return false;
    }