App\Http\Controllers\AppController::testMail PHP Method

testMail() private method

private testMail ( $mail )
    private function testMail($mail)
    {
        $email = $mail['username'];
        $fromName = $mail['from']['name'];
        foreach ($mail as $key => $val) {
            Config::set("mail.{$key}", $val);
        }
        Config::set('mail.from.address', $email);
        Config::set('mail.from.name', $fromName);
        $data = ['text' => 'Test email'];
        try {
            $response = $this->mailer->sendTo($email, $email, $fromName, 'Test email', 'contact', $data);
            return $response === true ? 'Sent' : $response;
        } catch (Exception $e) {
            return $e->getMessage();
        }
    }