Below is my sendmail jsp (I copied it from somewhere else and it works for
me). It fetches the message from another page and sends it to a email. The
problem is that the smtp needs authentication. How do I add the
authentication detail in this jsp? And, how do I include the web page
instead of plain text in the email to be sent just like how it appears in
the email text area when I hit "Send page by email". Thanks.
<%@ page import="sun.net .smtp.SmtpClien t, java.io.*" %>
<%
String strParm = request.getPara meter("Message" );
String from="1@2.com";
String to="2@3.com";
try{
SmtpClient client = new SmtpClient("smt p.2.com");
client.from(fro m);
client.to(to);
PrintStream message = client.startMes sage();
message.println ("To: " + to);
message.println ("Subject: New Mail");
message.println (strParm);
client.closeSer ver();
}
catch (IOException e){
System.out.prin tln("ERROR SENDING EMAIL:"+e);
}
%>
_______________ _______________ _______________ _______________ _____
¡¹ ª±®a¶K¤h´ú¸Õª©¥ ¿¦¡µn³õ! http://www.bet.com.hk ¡¹
¦øªA¾¹¦«ºÞ¤Î¯²¥ ΪA°È¡A¥Ñ Newsgroup.com.h k Limited ±M·~ºÞ²z¡C
¤ë¶O§C¦Ü $300 ¡A¸Ô±¡½Ð*P¹q 3078 6888