phpmailer возвращает ответ null в slim

Я использую slim framework для создания api для android app.In CreateUser api, я отправляю почту пользователю с помощью phpmailer.Phpmailer отправляет письма пользователю совершенно, но мой ответ массива возвращает нулевой ответ массива из-за него. Когда я удалю код ответа phpmailer верен, и когда я добавляю его, он генерирует нулевой ответ.

Вот мой код в Dbhandler.php:

$app->post('/requestPreview', function() use ($app) { verifyRequiredParams(array('fname', 'lname', 'email','event_code','app_version')); global $user_id; $response = array(); $fname = urldecode($app->request->post('fname')); $lname = urldecode($app->request->post('lname')); $email = urldecode($app->request->post('email')); $event_code = urldecode($app->request->post('event_code')); $app_version = urldecode($app->request->post('app_version')); $db = new DbHandler(); //$db->sendmail($email); $res = $db->signup($fname, $lname, $email,$event_code,$app_version); if ($res['status']=="one") { //$password=$res['password']; $response["event_code"] = $event_code; $response["email"] = $email; $response["fname"] =$fname; $response["lname"] = $lname; $response["CreateUser"] = true; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPDebug = 2; $mail->Debugoutput = 'html'; $mail->Host = "smtp.gmail.com"; $mail->SMTPAuth = true; $mail->Username = "abc.abc@gmail.com"; $mail->Password = "***********"; $mail->SMTPSecure = 'tls'; $mail->Port = 587; $mail->From = "abc.abc@gmail.com"; $mail->AddAddress($email); $mail->isHTML(true); $mail->Subject = "Welcome to www.abc.com .Your Account has been created and your password is:"; $mail->Body = "Welcome to www.abc.com .Your Account has been created and your password is:"; $mail->send(); } else if ($res['status']=="two"){ $response["error"] ="already_in_system"; $response["fname"] = null; $response["lname"] = null; } echoRespnse(200, $response); });