Solved

Displaying an email message.

Posted on 2004-04-14
4
184 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
  • 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java: The Public Class Main 4 32
What does != "" mean in programming 8 84
junit as external jar or library 7 24
Regarding swagger API 1 16
This is about my first experience with programming Arduino.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
The viewer will learn how to implement Singleton Design Pattern in Java.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

821 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