Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. public static void main(String args[])
  2. {
  3. String url1;
  4. Properties prop = new Properties();
  5. try{
  6. InputStream input = new FileInputStream("config.properties");
  7. prop.load(input);
  8. System.out.println(prop.getProperty("url"));
  9. url1=prop.getProperty("url");
  10. final URL url = new URL(url1);
  11. HttpURLConnection huc = (HttpURLConnection) url.openConnection();
  12. int responseCode = huc.getResponseCode();
  13. if (responseCode != 404) {
  14. System.out.println("GOOD");
  15. } else {
  16. System.out.println("BAD");
  17. }
  18. }
  19.  
  20. catch(Exception e)
  21. {
  22.  
  23. String username ,password,host,port;
  24. username=prop.getProperty("username");
  25. password= prop.getProperty("password");
  26. host=prop.getProperty("host");
  27. port=prop.getProperty("port");
  28. System.out.println("username"+username);
  29. SendEmail email=new SendEmail(username,password,port,host);//user name and password
  30. email.sendMail("mohamedf.sharif@ril.com", "hey", "whats up");
  31. email.sendMail("fazal.shariff12@gmail.com", "hey", "whats up");
  32. //e.printStackTrace();
  33. System.out.println("done");
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement