• Post Reply Bookmark Topic Watch Topic
  • New Topic

SendEmail using SmtpClient error???  RSS feed

 
Tom Barns
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I'm trying to send email,I'm getting error says :"connection refused :no further information ".
I'm sure i'm supplying wrong arguments to from() and to() methods.
please take a look at my code and correct the argument.
thanks alot for your time.
import java.io.*;
import sun.net.smtp.SmtpClient;
import java.net.InetAddress;
import java.util.*;
public class senEmail
{
public static void main(String arg[])
{
PrintStream outMail;
SmtpClient sendmail;
try
{
sendmail = new SmtpClient("www.yahoo.com");
sendmail.from("mohseif@yahoo.com");
sendmail.to("bay68@yahoo.com");
outMail = sendmail.startMessage();
outMail.println("from :tester");
outMail.flush();
outMail.close();
sendmail.closeServer();
}
catch(Exception e)
{
//System.out.println(e.printSatckTrace());
System.out.println(e.getMessage());
}
}
}
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sort of question is really more appropriate for the "Other APIs" forum, where all the Java Mail developers hang out. SO I've moved it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!