• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in socket connection

biswajit ray
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i wrote a jsp program.Where i made a connection to yahoo.com i write the code as
<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%@ page import="java.util.*"%>
<%@ page import="javax.mail.internet.*"%>
<%@ page import="javax.mail.*"%>
<%@ page import="javax.activation.*"%>
<%@ page import="javax.mail.Transport"%>
<%@ page import="java.net.UnknownHostException"%>
<%@ page import="java.net.*"%>
<%@ page import="javax.mail.Message.*"%>
<%@ page import="com.jscape.inet.email.EmailMessage"%>
<%@ page import="com.jscape.inet.smtp.Smtp"%>

String from="nachiketa.rout@thinkways.com";
String to="biswajit_naukri@yahoo.com";
SmtpClient smtpclient = new SmtpClient("Thinkways25")//(this is the name of my localhost.the ipaddress is i gave both the name and ip address of my computer)
PrintStream message = smtpclient.startMessage();
message.println("To: " + to);
message.println("Subject: Sending email from JSP!");
message.println("This was sent from a JSP page!");
message.println("Cool beans! :-)");

System.out.println("hi done");
catch (Exception e){
System.out.println("ERROR SENDING EMAIL:"+e);

but i m getting the error java.net.UnknownHostException: mailhost
plz help me in this regard.
if possible plz show me the right code
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!