Author
I'm trying to make my code send me email - pliz help.
Nina Savannah
Ranch Hand
Joined: Oct 15, 2008
Posts: 35
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
Joined: Aug 15, 2004
Posts: 2874
SmtpClient class belongs to which package?
However, it looks like you closed it without sending the email.
Nina Savannah
Ranch Hand
Joined: Oct 15, 2008
Posts: 35
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
Ranch Hand
Joined: Jan 08, 2009
Posts: 1237
is mail.magareta375a.org a valid url, you normally get the mentioned exception when it fails to connect to the given url.
Swastik
Nina Savannah
Ranch Hand
Joined: Oct 15, 2008
Posts: 35
Yes it is valid.
I even tried using the IP address but I'm still getting the same error.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35443
posted Jan 21, 2009 04:43:20
0
You're better off not using any sun.* classes; consider something like http://commons.apache.org/email/ instead.
Android apps – ImageJ plugins – Java web charts
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted Jan 21, 2009 05:36:29
0
Or the great JavaMail API: http://java.sun.com/products/javamail/FAQ.html
Code depot of a Java EE / JSF developer | JSF / Eclipse / Tomcat kickoff tutorial | DAO kickoff tutorial | I ♥ Unicode
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
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
[Smart Questions ] [JSP FAQ ] [Books by Bear ] [Bear's FrontMan ] [About Bear ]
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
As Ulf already mentioned, the sun.* packages are not standard Java libraries. Hence, the use is very much discourage.
Nina Savannah
Ranch Hand
Joined: Oct 15, 2008
Posts: 35
Thank you so much for your help. I have managed to get it working!
subject: I'm trying to make my code send me email - pliz help.