function sendMail($email, $theme, $post, $comments = FALSE) { $settings = new Model_Settings($this->registry); if (isset($this->registry["module_users"])) { $who = $this->registry["module_users"]->getUserInfo($post[0]["who"]); $post[0]["who"] = $who["name"] . " " . $who["soname"]; $post[0]["start"] = $settings->editDate($post[0]["start"]); $post[0]["ending"] = $settings->editDate($post[0]["ending"]); for ($i = 0; $i < count($comments); $i++) { $comments[$i]["timestamp"] = $settings->editDate($comments[$i]["timestamp"]); } $text = $this->view->render("mail", array("post" => $post, "comments" => $comments)); $_POST["subject"] = " <<< Задача " . $post[0]["id"] . ". " . $theme . " >>>"; $_POST["textfield"] = $text; $_POST["to"] = $email; $this->phpmailer($_POST); } }