javax.mail.Session mailSession = null;
try {
mailSession = (javax.mail.Session) env.lookup("MyEmail");
} catch (NamingException ne) { }
HttpServletRequest hRequest = null;
if (request instanceof HttpServletRequest){
hRequest = (HttpServletRequest) request;
HttpSession hSession = hRequest.getSession();
if (hSession != null)
hSession.setAttribute("MyEmail",mailSession);
}//if
chain.doFilter(request,response);