Solved

Displaying an email message.

Posted on 2004-04-14
4
201 Views
Last Modified: 2013-11-24
I am developing a WEB BASED email client using java mail API. I have given a text area to type the email. But when the email is displayed everthing comes in the same line. For example,

Dear aaaa
    bbbb
Regards cccc


Comes as

Dear aaaabbbbRegards cccc

What should I do for this?




0
Comment
Question by:arshadsam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 10830695
In HTML line Feed Command is <br> but in text based files its #10 and #13 (Line feed + Return)

U must add <br> after end of each text line.  Or other way .. But a multiline Text box in ur HTML code and set a default value of ur Email Text Body

0
 

Author Comment

by:arshadsam
ID: 10831238
Do you mean a TextArea. If so there is no way to add <br> after end of each text line.

The value of the textarea is simple taken as follows,
   request.getParameter("textarea_name");


Or is there are a seperate multiline textbox in html?

Thanks
Arshad.
0
 
LVL 19

Accepted Solution

by:
Melih SARICA earned 50 total points
ID: 10831288
there 2 ways..

1.  Using a textbox in ur Page. and setting the mail body as the value of the Textbox.. this is easier..


2.  If u can get the mail body line by line .. add <br> after each line of the message body


Now. send the code of writing ur mail body in ur page..

&#305; guess u use something like  <% repsonse.write(mailbody) %>  is it true ?
0
 

Author Comment

by:arshadsam
ID: 10831450
I appended <br> when reading the mail line by line.

thisLine = reader.readLine();
                System.out.println("Line="+thisLine);
                while ((thisLine != null) && (!thisLine.trim().equals("null")))
                {
                    sbMsg.append(thisLine+"<br>");
                    thisLine = reader.readLine();
                }

Thanks

Arshad

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Introduction to Processes

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question