I'm using Java 8 and Spring API to compose the mail body as below.
StringBuilder emailTemplateForNewPassword = new StringBuilder();
emailTemplateForNewPassword.append("Dear User,");
emailTemplateForNewPassword.append(System.lineSeparator());
emailTemplateForNewPassword.append(System.lineSeparator());
emailTemplateForNewPassword.append("Sample Mail.");
emailTemplateForNewPassword.append(System.lineSeparator());
emailTemplateForNewPassword.append(System.lineSeparator());
emailTemplateForNewPassword.append("Yours Faityfully,");
emailTemplateForNewPassword.append(System.lineSeparator());
emailTemplateForNewPassword.append("ABC.Com");
emailTemplateForNewPassword.append(System.lineSeparator());
emailTemplateForNewPassword.append("0094778999658");
Expected result:
Dear User,
Sample Mail.
Yours Faithfully,
ABC.Com
0094778999658Actual Result:
Dear User,
Sample Mail.
Yours Faithfully, ABC.Com 0094778999658
I am not sure why the last 3 lines come on same line even that I used System.lineSeparator()
.
I have already tried "\r\n"
but no luck.
Can anyone suggest what's wrong ?
I know that there are other questions related to this but none of them imsolve my problem. Please do not downcast this question until I find the answer.