• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

send e-mail with javamail

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the Other Java APIs forum where JavaMail is discussed.
 
reply
    Bookmark Topic Watch Topic
  • New Topic