/** * Creates (or reuses) a password assistance session, and sends a password * assistance mail to the specified user. * Note: To prevent DOS attacks, a new session is created only, if no session * exists, or if the existing session has been expired. * The password assistance mail contains an URL, which points to this script * and contains the following URL parameters: * client_id * key * @param $email * @param $logins */ public function sendUsernameAssistanceMail($email, array $logins) { require_once 'Services/Mail/classes/class.ilMailbox.php'; require_once 'Services/Mail/classes/class.ilMimeMail.php'; require_once 'include/inc.pwassist_session_handler.php'; $protocol = $this->https->isDetected() ? 'https://' : 'http://'; $server_url = $protocol . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')) . '/'; $login_url = $server_url . 'pwassist.php' . '?client_id=' . $this->ilias->getClientId() . '&lang=' . $this->lng->getLangKey(); $contact_address = $this->settings->get('admin_email'); $mm = new ilMimeMail(); $mm->Subject($this->lng->txt('pwassist_mail_subject')); $mm->From($contact_address); $mm->To($email); $mm->Body(str_replace(array("\\n", "\\t"), array("\n", "\t"), sprintf($this->lng->txt('pwassist_username_mail_body'), join($logins, ",\n"), $server_url, $_SERVER['REMOTE_ADDR'], $email, 'mailto:' . $contact_address, $login_url))); $mm->Send(); }