hi,
i want to send e-mail using jsp. when i run my code no error is shown but the message is not
sent to email address.
here is the code
<html>
<body>
<form method=post action="aa.jsp" >
sender<input type=text name=text1><br>
Reciever<input type=text name=text2><br>
Subject<input type=text name=text3><br>
Message<textarea name='area1' rows=5 cols=30>
</textarea>
<input type=submit>
</form>
</body>
</html>
<%@page language="java" import="java.io.*,javax.activation.*,javax.servlet.*,javax.servlet.http.*, javax.mail.*,javax.mail.internet.*,javax.mail.event.*, java.net.*,java.util.*,com.mysql.jdbc.Driver" session="true" %>
<%
response.setContentType("text/html");
try
{
out.println("acb");
Properties props=new Properties();
props.put("mail.smtp.host", "smtp.jcom.net");
Session session1 = Session.getDefaultInstance(props,null);
String s1 = request.getParameter("text1");
String s2 = request.getParameter("text2");
out.println("acb");
String s3 = request.getParameter("text3");
String s4 = request.getParameter("area1");
Message message =new MimeMessage(session1);
message.setFrom(new InternetAddress(s1));
message.setRecipients
(Message.RecipientType.TO,InternetAddress.parse(s2,false));
message.setSubject(s3);
message.setText(s4);
out.println("acb");
Transport.send(message);
out.println("acb");
out.println("mail has been sent");
}
catch(Exception ex)
{
System.out.println("ERROR....."+ex);
}
%>