• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

No html page display along with E-mail receive

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic