Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I'm trying to make my code send me email - pliz help.

 
Nina Savannah
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to send an email message using the jsp code below. The message is not being sent but there is no error message either.
What could be wrong with my code?

 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SmtpClient class belongs to which package?

However, it looks like you closed it without sending the email.
 
Nina Savannah
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this at the top of my page. I dont know how to packages, do I need to do that.




This statement:- closes the select statement


The error I'm getting is the one below.

ERROR SENDING EMAIL:java.net.UnknownHostException: mailhost
 
Swastik Dey
Rancher
Posts: 1609
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is mail.magareta375a.org a valid url, you normally get the mentioned exception when it fails to connect to the given url.
 
Nina Savannah
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it is valid.

I even tried using the IP address but I'm still getting the same error.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're better off not using any sun.* classes; consider something like http://commons.apache.org/email/ instead.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or the great JavaMail API: http://java.sun.com/products/javamail/FAQ.html
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65110
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use real words when posting to the forums. Abbreviations such as "pliz" in place of "please" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

thanks,
bear
JavaRanch sheriff

 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Ulf already mentioned, the sun.* packages are not standard Java libraries. Hence, the use is very much discourage.
 
Nina Savannah
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much for your help. I have managed to get it working!

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic