Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Getting no effect of " \n" while using setContent()

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am new to java mail service.I have a doubt.




the content parameter that I am using inside setContent method has
some new line characters(\n) and a hyperlink also ,when I send the mail
I get the hyperlink but the contents are not shown in separate lines.
I tried using setText I am getting content in different lines but the
hyperlink is not visible

what should I do to get my contents in different lines as well as the hyperlink

Thanks
 
Dash Abhisek
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I introduced "<br></br>" instead of "\n" and it is working. but still then
I want to know if you have a better solution to this problem.

Thanks
Abhisek
[ November 12, 2008: Message edited by: Dash Abhisek ]
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i do not really know the api, but since you've set the mime type of the content to text/html, everything inside will be interpreted as html.

maybe a different mime type would solve your problem...
 
Sheriff
Posts: 22568
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dash Abhisek:
Hi All,

I introduced "<br></br>" instead of "\n" and it is working. but still then
I want to know if you have a better solution to this problem.


Actually, for HTML that is the correct symbol for line break.

Well, almost. <br> should not have an end tag. So just <br> is fine, and if you want to please XHTML as well you can use <br/>. </br> should never be used.
[ November 13, 2008: Message edited by: Rob Prime ]
 
No holds barred. And no bars holed. Except this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic