The moose likes HTML, CSS and JavaScript and the fly likes No html page display along with E-mail receive 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 » Engineering » HTML, CSS and JavaScript
Bookmark "No html page display along with E-mail receive" Watch "No html page display along with E-mail receive" New topic

No html page display along with E-mail receive

Vincent Leong

Joined: Jan 17, 2003
Posts: 1
My application owner try to get a html page to be attach to his email. Sometime, he got the page but sometime could not.
He encounter "Unknown host exception" when hit the problem.
Sample of the code use for getting the url & sending it via email:
URL urlObj = new URL(url);
URLConnection urlConn = urlObj.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
StringBuffer sb = new StringBuffer();
Thanks for any help.
christoph weingarten
Ranch Hand

Joined: Oct 10, 2002
Posts: 39
your code looks like java. anyway.
throwing an "unkown host exception" has the following reason:
"Thrown to indicate that the IP address of a host could not be determined." (from java.net API )
try to prompt the hostname from within your application in System.out.
if you know the hostname you could ping the server by its name.
if this doesn't work, you could add the hostname and it's IP to a file called hosts (on LINUX and Windwows machines).
LINUX: /etc/hosts
WIN: [WINHOME}\system32\drivers\etc\hosts
Don't get me started about those stupid light bulbs.
subject: No html page display along with E-mail receive
Similar Threads
How can I capture the output of a JSP file and send an email?
Multiple posts using HttpURLConnection
How to save html output of jsp into a file
Differences in code? plz help
screen scrape