thanks 4 ur reply kashif...i m using following code,can u pls tell me where shud i provide username n password..
moreover is it not possible to send mail if i don't know the user name or passwrd of server?is there any way possible?
String host ="my_host_name";
String from = "abc@somename";
String to ="xyz@samename";
String subject = "This is a trial msg!";
String message = "Message comes here!";
Properties prop =System.getProperties();
prop.put("mail.host", host);
Session ses1 = Session.getDefaultInstance(prop,null);
MimeMessage msg = new MimeMessage(ses1);
msg.setFrom(new InternetAddress(from))
msg.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
msg.setSubject(subject);
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(message);
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
Transport.send(msg);