At the point where you are now writing to disk, use the new java email
classes (as of 1.1x) to create and send the message.
-- Curt Springer
Team ND
At 05:43 AM 8/26/99 -0700, Rimma wrote:
>Hello,
>
>In my application I need to generate an HTML file. And, as a final step,
>before the final
>copy of the document is being displayed on the screen, I need to
>automatically send
>it as an e-mail to a user. What is the simplest way to do so?
>
>Right now, I have code to automatically save it on my C- drive:
>
>public int this_onBeforeHtmlOutputEvent(CSpHtmlOutputEvent event)
> {
> try
> {
> CSpStringOutputStream _origStream =
> CSpider.getOutputStream ();
> ByteArrayOutputStream _myArrayStream = new
> ByteArrayOutputStream (20000);
> CSpStringOutputStream _myStream = new
> CSpStringOutputStream (_myArrayStream);
>
> // Flush everything so that our byte array will
> get loaded
> // with the HTML
> CSpHtml.flush (_myStream);
>
> // Convert the byteArray into a String
> String htmlPage = _myArrayStream.toString ();
>
> // Modify HTML for file output
> String modifiedHtmlPage =
> CSpUtil.replaceSubstring (htmlPage, "<IMG src=\"/images/dailyne2.gif\"
> width=\"129\" height=\"45\" border=\"0\" align=\"middle\">",
> "<Font size=+3><b>Daily
> News</b></font>");
> modifiedHtmlPage = CSpUtil.replaceSubstring
> (modifiedHtmlPage, "<IMG src=\"/images/archive.gif\" border=\"0\"
> width=\"77\" height=\"28\">", "");
> modifiedHtmlPage = CSpUtil.replaceSubstring
> (modifiedHtmlPage, "<IMG src=\"/images/date.gif\" border=\"0\"
> width=\"40\" height=\"28\">", "");
>
> // Create file and store modified HTML init
> String fileName = "C:\\temp\\"+
> CSpider.getUserSessionObject("sesDate").toString() + ".html";
>//CSpHtml.write ("File Name: " + fileName);
> FileOutputStream newsFile = new
> FileOutputStream(fileName);
> newsFile.write (modifiedHtmlPage.getBytes());
> newsFile.close();
>
> // Restore the original output stream
> //CSpider.setOutputStream (_origStream);
>
> // Write the modified HTML out
> CSpHtml.sendRawDataItem (_origStream, htmlPage);
> }
> catch (Exception ex)
> {
> CSpHtml.sendMessage ("Search result: " + ex);
> }
> return (PROCEED);
> }
>
>Thanks for your help!
>Rimma
>_________________________________________________________________________
>
>For help in using, subscribing, and unsubscribing to the discussion
>forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
>
>For dire need help, email: [EMAIL PROTECTED]
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]