socket exception and message exception is fired
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Senthil_Kumar
Posted On:   Wednesday, October 19, 2005 08:39 AM

while sending mail through the microsoft outlook it is working.but mail through java is not send. the following error will shown: smtp server is installed on -->incsbs01p.obistech.local my system name is -->INCDB005.OBSITECH.local program import javax.mail.*; import java.util.*; import javax.mail.internet.*; public class mailinjava { public static void main(String aa[])throws Exception { if(aa.length <3) { useage(); } try { Properties prop=new Properties(); prop.put("incsbs01p.OBSITECH.local","incsbs01p"); Sessio   More>>

while sending mail through the microsoft outlook it is working.but mail through java is not send.
the following error will shown:




smtp server is installed on -->incsbs01p.obistech.local
my system name is -->INCDB005.OBSITECH.local




program


import javax.mail.*;

import java.util.*;

import javax.mail.internet.*;

public class mailinjava

{

public static void main(String aa[])throws Exception

{

if(aa.length <3)

{

useage();

}

try

{

Properties prop=new Properties();

prop.put("incsbs01p.OBSITECH.local","incsbs01p");

Session session=Session.getDefaultInstance(prop,null);

session.setDebug(false);

Message msg=new MimeMessage(session);

InternetAddress addressfrom=new InternetAddress("senthild@obsi.in");

msg.setFrom(addressfrom);

Address addressto=new InternetAddress(aa[0]);

msg.setRecipient(Message.RecipientType.TO, addressto);

msg.setSubject(aa[1]);

msg.setContent(aa[2],"text/html");

Transport transport=session.getTransport("smtp");

transport.send(msg);

}catch(Exception e){System.out.println(e);}

}

public static void useage()

{

System.out.println("usage: ");

System.exit(1);

}

}



program running:

C:PROGRA~1JavaJDK15~1.0_0 in>java mailinjava senthild@obsi.in test test


error displayed
javax.mail.MessagingException: Could not connect to SMTP host: localhost, port:25;
nested exception is: java.net.SocketException: Software caused connection abort: connect


pls help me to correct this java program.

   <<Less

Re: socket exception and message exception is fired

Posted By:   Anonymous  
Posted On:   Friday, January 6, 2006 09:25 AM

Disable your Virus Scanner It will Work.
It's a Gr8 Bug i too working on it to fix it up.

Regards
Raveen

Re: socket exception and message exception is fired

Posted By:   Stefan_Preuss  
Posted On:   Friday, October 21, 2005 04:17 AM

You don't set a valid smtp server so JM connects to localhost. Try this:

prop.put("mail.smtp.host", "incsbs01p.OBSITECH.local");
About | Sitemap | Contact