dcsimg
solution for this problem
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   ananth_sivasubramaniyan
Posted On:   Thursday, May 15, 2003 07:06 AM

Using javamail to receive inbox at the time of connect statement the following error is coming &Error javax.mail.MessagingException: Connection timed out: connect; nested exception is: java.net.ConnectException: Connection timed out: connect the code is String hostname="192.168.1.50"; String username="ananth_isak@hotmail.com"; String password="machine"; String protocol="imap"; String mbox="INBOX"; try { URLName url=new URLName(protocol,hostname,-1,mbox,username,password); HttpSession ssn=req.getSession(true);    More>>
Using javamail to receive inbox
at the time of connect statement the following error is coming


&Error javax.mail.MessagingException: Connection timed out: connect;
nested exception is:
java.net.ConnectException: Connection timed out: connect

the code is
			
				
String hostname="192.168.1.50";
String username="ananth_isak@hotmail.com";
String password="machine";
String protocol="imap";
String mbox="INBOX";

try
{
URLName url=new URLName(protocol,hostname,-1,mbox,username,password);


HttpSession ssn=req.getSession(true);
MailUserData mud=new MailUserData(url);

ssn.putValue("getinbox",mud);

Properties props=System.getProperties();
props.put("mail.smtp.host",hostname);


Session session=Session.getDefaultInstance(props,null);
session.setDebug(false);


Store store=session.getStore(url);

// connect(hostname,username,password);

System.out.println("before connect ");

store.connect(hostname,username,password);


Folder folder=store.getDefaultFolder();
folder=folder.getFolder(mbox);


folder.open(Folder.READ_WRITE);

int totalmessages=folder.getMessageCount();


Message message[]=folder.getMessages();

FetchProfile fp=new FetchProfile();

fp.add(FetchProfile.Item.ENVELOPE);

folder.fetch(message,fp);


System.out.println(" url name "+store.getURLName());

mud.setSession(session);
mud.setStore(store);
mud.setFolder(folder);



for(int i=0,n=message.length;i
{
out.println(i+" : "+message[i].getFrom()[0]+" "+message[i].getSubject());

}

folder.close(false);
store.close();

Any body can clarify this plz    <<Less

Re: solution for this problem

Posted By:   Adrian_K  
Posted On:   Thursday, May 15, 2003 07:28 AM

Please, use
 tags in orden to clarify the code.
About | Sitemap | Contact