Hello my forum pals,
In my application, I'm generating an HTML file. And as it loads into the browser,
it's also
supposed to be sent automatically the the user via e-mail. I was told on the forum
that
I can use the new Sun Java e-mail class which I downloaded from the Sun's web site.
However, I don't know how to use it with my ND app. Do you have any suggestions?
I'm pasting the code from the OnBeforeHTMLOutput event for the page and I'm attaching
the page itself, in case it will be helpful.
Thanks,
Rimma
//[[SPIDER_EVENT<this_onBeforeHtmlOutputEvent>
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);
}
//]]SPIDER_EVENT<this_onBeforeHtmlOutputEvent>
Title: pgSearchResult
**SPIDERSESSION** [[/SPIDERPAGE]]
