public function restore($data) { $user = $this->getByEmail($data['email']); if (!empty($user)) { $this->mail->handleTemplate('restore.access', $user); $this->mail->to = $user['email']; $this->mail->send(); } }
public function restoreAccessByEmail($email) { $sql = $this->db->select()->from($this->table, array('email', 'username', 'password', 'id'))->where('email = ?', $email); $user = $this->db->fetchRow($sql); if ($user) { $attributes = $this->emailTemplate->getHandledTemplate('restore.access', array('user' => $user)); $this->mail->setAttributes($attributes); $this->mail->send($user['email']); return true; } $this->addError('User with this email not found'); return false; }