public function resetPassword(Admin_Model_User $user) { $login = Zend_Json::decode($this->getApiHelper()->direct(array('app' => $this->getApiHelper()->name('login'), 'key' => $this->getApiHelper()->key('login'), 'user_id' => $user->getId(), 'admin_id' => $this->getSession()->userid, 'token' => uniqid()), $this->getApiHelper()->endpoint('login') . 'adminresettoken')); if ($login['error'] == 0) { // get email templates $vars = array('url' => 'https://' . $_SERVER['HTTP_HOST'] . '/love/resetpass.php?un=' . base64_encode($login['username']) . '&token=' . $login['confirm_string']); $view = new Zend_View(); $view->setScriptPath(APPLICATION_PATH . '/views/scripts/emails'); $view->assign($vars); // send email $mail = new Sendlove_Mail(); $mail->setBodyHtml($view->render('html_recovery.phtml')); $mail->setBodyText($view->render('text_recovery.phtml')); $mail->setFrom('*****@*****.**', 'SendLove'); $mail->addTo($login['username']); $mail->setSubject('SendLove Password Recovery'); $mail->send(); return true; } return false; }
protected function sendCreateMail(array $vars = array()) { if (empty($vars)) { throw new Exception('You must set the email variables'); } // get email templates $view = new Zend_View(); $view->setScriptPath(APPLICATION_PATH . '/views/scripts/emails'); $view->assign($vars); // send email $mail = new Sendlove_Mail(); $mail->setBodyHtml($view->render('html_create_user.phtml')); $mail->setBodyText($view->render('text_create_user.phtml')); $mail->setFrom('*****@*****.**', 'SendLove'); $mail->addTo($vars['user_username']); $mail->setSubject('SendLove User Account Created'); if ($mail->send()) { return true; } return false; }