• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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: 67637
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.
 
You didn't tell me he was so big. Unlike this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic