#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    1
    Rep Power
    0

    Exclamation Sending html email rendered from JSP


    I need to send a large set of customized HTML emails, and I'd like to template the html with JSP.

    Has anyone ever done this or know how I might go about it?

    Basically, I want to have a servlet which is supplied some data (eg, first name, last name, email), uses a JSP page to assemble the data and email contents, and sends the JSP output as an HTML email.

    Is there any easy way to do this? I'm stuck on how to render the JSP from within the servlet.

    Any help or suggestion would be greatly appreciated!!!!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    78
    Rep Power
    12
    You can't "render" your jsp in your servlet, but you can make a URL connection to the jsp passing any parameters needed and then capture the response character stream and store the generated html code from the jsp into a StringBuffer from your servlet. Then use the stringBuffer to put the html code into your email as the body.

    I think you might need to set a flag or something to make sure the email message renders as an html page rather than the actual html code (i.e. a mime type or something). Not sure how you would do this.

IMN logo majestic logo threadwatch logo seochat tools logo