struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adam <>
Subject Re: [Somewhat OT] Sending HTML email using struts/java/javamail
Date Thu, 25 Apr 2002 18:03:37 GMT
1.Create a jsp that Generates your email.  
2.Find out the name of the class that your JSP compiler creates.  You 
can force this with most JSP compilers.
3. Create an instance of that class and pass a custom request and 
response object to its get method.   The response object will contain 
the html genereated by the jsp when you are done.  Try toString(), but 
it may need to get it from getWriter() or something.  Depends on how you 
create your response object.
4.Dump the html from the response into your email.
5.Lather, rinse.repeat

Actually, a better way may be

Rick Reumann wrote:

>On Wednesday, April 24, 2002, 9:13:17 PM, Edward Muller wrote:
>EM> I have an internal application that needs to send a html email
>EM> (management choice, not mine). The application is a mini struts
>EM> application, but I need to manually format the html email using a
>EM> large string and constantly appending to it and then I send the
>EM> email via javamail.
>EM> Does anyone know of a better way?
>    I like to write the html page to a file. Then with the java.mail
>    api you can send the file you created (something.html) as an
>    attachment.
>EM> I'd like to just pass my form bean to another jsp, get the results back
>EM> (formatted as HTML) and then use javamail to send the email...
>"As the light changed from red to green to yellow and back to red
>again, I sat there thinking about life. Was it nothing more than a
>bunch of honking and yelling? Sometimes it seemed that way."
>  -Jack Handey
>To unsubscribe, e-mail:   <>
>For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message