Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8852213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:20:36+00:00 2026-06-14T13:20:36+00:00

StringBuffer emailMessage = new StringBuffer(Dear Scott); emailMessage.append(\r\n); emailMessage.append(Sending mail over internet); So here is

  • 0
StringBuffer emailMessage = new StringBuffer("Dear Scott");
emailMessage.append("\r\n");
emailMessage.append("Sending mail over internet");

So here is my formatted content when i inspect in debugger

Dear Scott,
Sending mail over internet

But when i receive it in thunderbird, i receive complete message in one line like below. Somehow newline character
is not interpreted correctly when sending the content as html

 Dear Scott,Sending mail over internet

here is how i am sending the message as html

 MimeMessage msg = null;
 msg = new MimeMessage(mailSession);
 msg.setText(body, CHARSET_UTF_8, "html");

If i simply send the text as msg.setText(body, CHARSET_UTF_8) then i see the message in right format i.e “Sending mail over internet” in seen in
next line. I am not getting why new line character is not interpreted correctly when sending the text as html?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:20:37+00:00Added an answer on June 14, 2026 at 1:20 pm

    Because you’re sending an HTML email, you have to use <br /> instead of \r\n, just like a classic HTML document (e.g. a .html file). When you use \r\n, the rendered content won’t print a new line, but the source code of the mail will (and vice versa).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

StringBuffer sb=new StringBuffer(Hello); sb.append(welcome);//working sb.concat(hi);//not working Why can't i use concat here??
ArrayList queryParms = new ArrayList(); StringBuffer sql = new StringBuffer(); sql.append( SELECT A.FLDREC_NUM, +
I'm using a sql statement in my program. stringBuffer sql=new StringBuffer(); sql.append(insert into customer
Below is code snippet in instance method String x = new StringBuffer().append(a).append(b).append(c).toString() i am
JTextArea txt = new JTextArea(); StringBuffer sb = new StringBuffer(); sb.append(Employee Information); sb.append(\n); sb.append(Name:);
I have declared two string buffers like, private StringBuffer buf = new StringBuffer(1024); private
xml.append(<alertDesc>); xml.append(desc); xml.append(</alertDesc>); response.getWriter().write(xml.toString()); response.setContentType(text/xml); response.setHeader(Cache-Control, no-cache); xml is a StringBuffer object. I have
StringBuffer sb = new StringBuffer(abc); StringBuffer sb1 = sb; StringBuffer sb2 = new StringBuffer(abc);
Possible Duplicate: How to get equivalent of ResultSetMetaData without ResultSet StringBuffer queryBuffer=new StringBuffer(SELECT *
Why String.equls() returns true but Stringbuilder.equals() returns false? StringBuffer sb1 = new StringBuffer(Amit); StringBuffer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.