• Post Reply Bookmark Topic Watch Topic
  • New Topic

send e-mail with javamail

 
Carlos Gardenal
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I am trying to send an e-mail with the JavaMail API, but I am not being successful. Here is the code:
try{
SmtpClient client = new SmtpClient("???.???.?.?");
//client.from("mymailfrom@test.com");
client.to("mymailto@test.com");
PrintStream message = client.startMessage();
message.println("From: " + from);
message.println("To: " + to);
message.println("This was sent from a JSP page!");
message.println();
client.();
client.closeServer();
}
catch (IOException e){
System.out.println("ERROR SENDING EMAIL:"+e);
}

And here is the error:
C:\Tomcat 4.1\work\Standalone\localhost\examples\jsp\Cms\cmsEmail_jsp.java:56: cannot resolve symbol
symbol : method sendMail ()
location: class sun.net.smtp.SmtpClient
client.sendMail();
^
1 error
I don't know the correct host and port to use.
Could anyone help me? Where is the problem?
Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Other Java APIs forum where JavaMail is discussed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!