title: New line Command (\n) was not working while handline files with TomCat
body: <p>I am trying a to send a mail by reading contents from text file.</p>
  
  <p>File I am trying to read</p>
  
  <pre><code>Line 1
  Line 2
  Line 3
  </code></pre>
  
  <p>I have tested the code with JUnit and I get the mail with same formatting as in the text file.</p>
  
  <p>Output mail using Junit </p>
  
  <pre><code>Line 1
  Line 2
  Line 3
  </code></pre>
  
  <p>But when deployed in Tomcat, I get a mail with the text but new lines are not getting recognized.</p>
  
  <p>Output mail when using tomcat server</p>
  
  <pre><code>Line 1Line 2Line 3
  </code></pre>
  
  <p>Code that I am using to read the contents of the file.</p>
  
  <pre><code>private String readFile(String pathname) throws IOException {
          File file = new File(pathname);
          StringBuilder fileContents = new StringBuilder((int) file.length());
          Scanner scanner = new Scanner(file);
          String lineSeparator = System.getProperty("line.separator");
  
          try {
              while (scanner.hasNextLine()) {
                  fileContents.append(scanner.nextLine() + lineSeparator);
              }
              return fileContents.toString();
          } finally {
              scanner.close();
          }
      }
  </code></pre>
  
  <p>I have put the server in debug mode and I can see that new line is getting appended in <code>fileContents.toString()</code></p>
  
  <p>I am not sure what I am missing. Anything related to character set? I am not sure....</p>