mailBody += "No user logged in.";
mailBody += "No user logged in, or session was lost";
    public ActionForward sendEmail(ActionMapping mapping, ActionForm form, HttpServletRequest request,            HttpServletResponse response) throws Exception {        HttpSession session = request.getSession();        ActionMapping originalMapping = (ActionMapping) session                .getAttribute(SessionConstants.ORIGINAL_MAPPING_KEY);        DynaActionForm emailForm = (DynaActionForm) form;        String formEmail = (String) emailForm.get("email");        String formSubject = (String) emailForm.get("subject");        String formBody = (String) emailForm.get("body");        StackTraceElement[] stackTrace = (StackTraceElement[]) session                .getAttribute(SessionConstants.EXCEPTION_STACK_TRACE);        String requestContext = (String) session.getAttribute(SessionConstants.REQUEST_CONTEXT);        String sender = "Sender: " + formEmail;        String subject = " - " + formSubject;        String mailBody = "Error Report\n\n";        mailBody += sender + "\n\n";        mailBody += "User Comment: \n" + formBody + "\n\n";        mailBody += "Error Origin: \n";        mailBody += "Exception: \n" + session.getAttribute(Globals.EXCEPTION_KEY) + "\n\n";        mailBody += "RequestContext: \n" + requestContext + "\n\n\n";        mailBody += "SessionContext: \n" + sessionContextGetter(request) + "\n\n\n";        mailBody += "Path: " + originalMapping.getPath() + "\n";        mailBody += "Name: " + originalMapping.getName() + "\n";        IUserView userView = (IUserView) session.getAttribute("UserView");        if (userView != null) {            mailBody += "UserLogedIn: " + userView.getUtilizador() + "\n";        } else {            mailBody += "No user logged in.";        }        mailBody += stackTrace2String(stackTrace);        EMail email = null;        if (!request.getServerName().equals("localhost")) {            email = new EMail("mail.adm", "erro@dot.ist.utl.pt");            email.send("suporte@dot.ist.utl.pt", "Fenix Error Report" + subject, mailBody);        }        else {            email = new EMail("mail.rnl.ist.utl.pt", "erro@dot.ist.utl.pt");            email.send("suporte@dot.ist.utl.pt", "Localhost Error Report", mailBody);        }        //		email.send("j.mota@netcabo.pt", subject, mailBody);        //		email.send("lepc@mega.ist.utl.pt", subject, mailBody);        //		removes from session all the un-needed info        sessionRemover(request);        ActionForward actionForward = originalMapping.getInputForward();        RequestUtils.selectModule(originalMapping.getModuleConfig().getPrefix(), request, this.servlet                .getServletContext());        actionForward.setPath(actionForward.getPath());        return actionForward;    }