response.setContentType("text/html");
java.io.PrintWriter out = response.getWriter();
out.println(
"<html><head><title>Email message sender</title></head><body>");
EmailBean emailer = new EmailBean();
emailer.setSubject("This is not spam!");
emailer.setContent("Please call ASAP.");
emailer.setTo("myfriend@yahoo.com");
emailer.setFrom("author@jspservletcookbook.com");
emailer.setSmtpHost("smtp.comcast.net");
try{
emailer.sendMessage();
} catch (Exception e) {throw new ServletException(e);}
out.println("</body></html>");