AccountManager.sendRegistrationInfo(context, email);
try { AccountManager.sendRegistrationInfo(context, email); } catch (javax.mail.SendFailedException e) { if (e.getNextException() instanceof SMTPAddressFailedException) {  log.info(LogManager.getHeader(context, "invalid_email", "email=" + email)); request.setAttribute("retry", new Boolean(true)); JSPManager.showJSP(request, response, "/register/new-user.jsp"); return; } else { throw e; } }
    private void processEnterEmail(Context context, HttpServletRequest request,            HttpServletResponse response) throws ServletException, IOException,            SQLException, AuthorizeException    {        String email = request.getParameter("email").toLowerCase().trim();        String netid = request.getParameter("netid");        String password = request.getParameter("password");        EPerson eperson = EPerson.findByEmail(context, email);        EPerson eperson2 = null;        if (netid!=null) eperson2 = EPerson.findByNetid(context, netid);        try        {            if (registering)            {                // If an already-active user is trying to register, inform them so                if ((eperson != null && eperson.canLogIn()) || (eperson2 != null && eperson2.canLogIn()))                {                    log.info(LogManager.getHeader(context,                            "already_registered", "email=" + email));                    JSPManager.showJSP(request, response,                            "/register/already-registered.jsp");                }                else                {                    // Find out from site authenticator whether this email can                    // self-register                    boolean canRegister =                        AuthenticationManager.canSelfRegister(context, request, email);                    if (canRegister)                    {                        //-- registering by email                        if ((!ldap_enabled)||(netid==null)||(netid.trim().equals("")))                        {                            // OK to register.  Send token.                            log.info(LogManager.getHeader(context,                                "sendtoken_register", "email=" + email));                            AccountManager.sendRegistrationInfo(context, email);                            JSPManager.showJSP(request, response,                                "/register/registration-sent.jsp");                            // Context needs completing to write registration data                            context.complete();                        }                        //-- registering by netid                        else                         {                            //--------- START LDAP AUTH SECTION -------------                            if (password!=null && !password.equals(""))                             {                                String ldap_provider_url = ConfigurationManager.getProperty("ldap.provider_url");                                String ldap_id_field = ConfigurationManager.getProperty("ldap.id_field");                                String ldap_search_context = ConfigurationManager.getProperty("ldap.search_context");                                                           // Set up environment for creating initial context                                Hashtable env = new Hashtable(11);                                env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");                                env.put(javax.naming.Context.PROVIDER_URL, ldap_provider_url);                                                        // Authenticate                                 env.put(javax.naming.Context.SECURITY_AUTHENTICATION, "simple");                                env.put(javax.naming.Context.SECURITY_PRINCIPAL, ldap_id_field+"="+netid+","+ldap_search_context);                                env.put(javax.naming.Context.SECURITY_CREDENTIALS, password);                                                        try {                                   // Create initial context                                   DirContext ctx = new InitialDirContext(env);                                                // Close the context when we're done                                   ctx.close();                                }                                 catch (NamingException e)                                 {                                    // If we reach here, supplied email/password was duff.                                    log.info(LogManager.getHeader(context,                                        "failed_login",                                        "netid=" + netid + e));                                    JSPManager.showJSP(request, response, "/login/ldap-incorrect.jsp");                                    return;                                }                            }                            //--------- END LDAP AUTH SECTION -------------                            // Forward to "personal info page"                            JSPManager.showJSP(request, response, "/register/registration-form.jsp");                        }                    }                    else                    {                        JSPManager.showJSP(request, response,                            "/register/cannot-register.jsp");                    }                }            }            else            {                if (eperson == null)                {                    // Invalid email address                    log.info(LogManager.getHeader(context, "unknown_email",                            "email=" + email));                    request.setAttribute("retry", new Boolean(true));                    JSPManager.showJSP(request, response,                            "/register/forgot-password.jsp");                }                else if (!eperson.canLogIn())                {                    // Can't give new password to inactive user                    log.info(LogManager.getHeader(context,                            "unregistered_forgot_password", "email=" + email));                    JSPManager.showJSP(request, response,                            "/register/inactive-account.jsp");                }                else if (eperson.getRequireCertificate() && !registering)                {                    // User that requires certificate can't get password                    log.info(LogManager.getHeader(context,                            "certificate_user_forgot_password", "email="                                    + email));                    JSPManager.showJSP(request, response,                            "/error/require-certificate.jsp");                }                else                {                    // OK to send forgot pw token.                    log.info(LogManager.getHeader(context,                            "sendtoken_forgotpw", "email=" + email));                    AccountManager.sendForgotPasswordInfo(context, email);                    JSPManager.showJSP(request, response,                            "/register/password-token-sent.jsp");                    // Context needs completing to write registration data                    context.complete();                }            }        }        catch (AddressException ae)        {            // Malformed e-mail address            log.info(LogManager.getHeader(context, "bad_email", "email="                    + email));            request.setAttribute("retry", new Boolean(true));            if (registering)            {                if (ldap_enabled) JSPManager.showJSP(request, response, "/register/new-ldap-user.jsp");                else JSPManager.showJSP(request, response, "/register/new-user.jsp");            }            else            {                JSPManager.showJSP(request, response,                        "/register/forgot-password.jsp");            }        }        catch (MessagingException me)        {            // Some other mailing error            log.info(LogManager.getHeader(context, "error_emailing", "email="                    + email), me);            JSPManager.showInternalError(request, response);        }    }