This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in socket connection  RSS feed

 
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
192.168.0.66 i gave both the name and ip address of my computer)
smtpclient.from(from);
smtpclient.to(to);
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();
message.println("Cool beans! :-)");
message.println();
message.println();

smtpclient.closeServer();
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!