Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package mail;
  7.  
  8. import java.io.*;
  9.  
  10. /**
  11. *
  12. * @author thorstenl
  13. */
  14. import java.io.IOException;
  15.  
  16. /**
  17. * Assumes UTF-8 encoding. JDK 7+.
  18. */
  19. public class Manager {
  20.  
  21. public static void main(String... aArgs) throws IOException {
  22. /* Mail mail = new Mail();
  23. mail.readFile(C:\opus\Mail\Sample.html);
  24. Scanner sc = new Scanner(system.in);
  25. // datei einlesen.
  26. // mail erstellen
  27. // mail befüllen
  28. // mail versenden
  29. //C:\opus\Mail\Sample.html */
  30.  
  31. Manager manager = new Manager();
  32. String htmlContent = manager.readFile("C:\\opus\\Mail\\Sample.html");
  33.  
  34. System.out.println(htmlContent);
  35.  
  36. }
  37.  
  38. public String readFile(String filePath) {
  39.  
  40. String output = "";
  41.  
  42. System.out.println("File einlesen.");
  43. try {
  44. FileReader fr = new FileReader(filePath);
  45. BufferedReader br = new BufferedReader(fr);
  46.  
  47. String zeile = "null"; /*Wir instanzieren eine Neue Variable, mit dem Namen "zeile", von der klasse "String" (KLassen werden immer groß geschrieben, variablen immer klein). */
  48. int i = 0;
  49. while ((zeile = br.readLine()) != null) {
  50. i++;
  51. System.out.println("Zeile: " + i+ ", Inhalt: " + zeile);
  52. output += zeile;
  53. }
  54. br.close();
  55. fr.close();
  56. } catch (Exception e) {
  57. e.printStackTrace();
  58. }
  59. return output;
  60. }
  61.  
  62. public void createMail() {
  63.  
  64. }
  65.  
  66. public void sendMail() {
  67.  
  68. }
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement