I found some great javascript code(xpHTMLMail file) to be able to create an HTML e-mail that the users create on the fly from an xpage document that they write a review on a salesperson. However, there are some Multiline edit boxes on there and they have carriage returns, spaces, etc in them. These do not come over when they are added to the HTML. Anything I can do to keep the formatting for the e-mail that is created? Thanks in advance.
Here’s the code that deals with this part of my question(inputClosing is a Multiline Edit Box):
mail.addHTML("<br /><br /><b>Closing</b><br />"+getComponent('inputClosing').getValue())
If inputClosing has…
“Dear Joe,
Great work. Keep it up!
Thanks,
Bill”
It comes into the email as…
Dear Joe, Great Work. Keep it up! Thanks, Bill
I wrote that library so thanks!
Since you’re creating an HTML mail, you need to replace the line breaks in the value of the Multiline Edit Box by
<br />tags. Since you’re dealing with Java in XPages, the line breaks are stored in the value using the\r\nsequence.You can replace them using the the replaceAll() or (SSJS) @ReplaceSubstring() function.
Your code might then look like this: