Problem in javaMAIL API..i have to send mail only.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Hitesh_Patel
Posted On:   Sunday, April 29, 2001 11:29 PM

hi, i have problem in java API.code given below.when i execute it exception comes like: sendFailedException: sending failed. nested exception is: javax.mail.MessagingException: 250 ok code: import java.util.*; import java.util.Properties; import java.io.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; import javax.com.*; public class sendmail { public static void main(String s[]) { try { Properties props=new Properties(); props.put("mail.smtp.host","mail.satyam.net.in"); System.out.println("mail.smtp.host");    More>>

hi,
i have problem in java API.code given below.when i execute it exception comes like:

sendFailedException: sending failed.

nested exception is:

javax.mail.MessagingException: 250 ok


code:

import java.util.*;
import java.util.Properties;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import javax.com.*;
public class sendmail
{
public static void main(String s[])
{
try
{
Properties props=new Properties();
props.put("mail.smtp.host","mail.satyam.net.in");
System.out.println("mail.smtp.host");
Session mailconnection=Session.getDefaultInstance(props,null);
System.out.println(mailconnection);
Address to=new InternetAddress("patelchetank@rediffmail.com","Chetan");
System.out.println(to);
Address from=new InternetAddress("hiteshmail@rediffmail.com","Hitesh");
System.out.println(from);
final MimeMessage msg=new MimeMessage(mailconnection);
msg.setContent("hello billgates","text/plain");
msg.setFrom(from);
msg.setRecipient(Message.RecipientType.TO,to);
msg.setSubject("Your Password is..");
Runnable r=new Runnable()
{
public void run()
{
try
{
Transport.send(msg);
}
catch(Exception e)
{
e.printStackTrace();
}
}
};
Thread t=new Thread(r);
t.start();
msg.setText("");
}
catch(MessagingException evt)
{
System.out.println(evt);
}
catch(UnsupportedEncodingException e)
{
System.out.println(e);
}
System.out.println("successFully sent..");
}
}


======================================

plz, help me.i need this solution quickly.
once again i would request U.

send it to my personal e-mail:
hiteshmail@rediffmail.com

Hitesh.

   <<Less
About | Sitemap | Contact