jwandscheer
jwandscheer

Reputation: 178

Javamail message content newline

I've made an E-Mail Client for my Android Phone using the JavaMail API, and I try to get the message Content with the following Code:

Object contentObject = p.getContent();
InputStream is = (InputStream) contentObject;
        reader = new BufferedReader(new InputStreamReader(is));
        StringBuilder sb = new StringBuilder();
        String line;

        while ((line = reader.readLine()) != null) {
            sb.append(line);
        }
        String everything = sb.toString();
        System.out.println(everything);
        return everything;

With this method, I get the messsage Content as a String, but without Newlines. How can I format this String that he has the newlines from the Message?

P.S.: This are German e- mails, so the problem may be the encoding!?

Upvotes: 0

Views: 793

Answers (1)

Sunil Kumar
Sunil Kumar

Reputation: 7092

Add like that

sb.append(line);

sb.append(System.getProperty("line.separator"));

Upvotes: 1

Related Questions