It's not a secret anymore!*
The moose likes Other JSE/JEE APIs and the fly likes I'm trying to make my code send me email - pliz help. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "I Watch "I New topic
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
Rancher

Joined: Jan 08, 2009
Posts: 1449
    
    6

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: 41133
    
  45
You're better off not using any sun.* classes; consider something like http://commons.apache.org/email/ instead.


Ping & DNS - my free Android networking tools app
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Or the great JavaMail API: http://java.sun.com/products/javamail/FAQ.html
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60791
    
  65

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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!

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I'm trying to make my code send me email - pliz help.
 
Similar Threads
Sending HTML format mail thru JSP
Error in sending mail through JSP using (SmtpClient)
NoSuchProviderException: smtp
basic question about smtp server
how to send a mail from a jsp?