1
votes

I need to add html to an email so I use Mark Leusink HTMLMail SSJS function. The html I have is in a richtext field and it looks like this.

"Content-Type: text/html; charset="utf-8"

<p dir="ltr">
 Test1</p>
<p dir="ltr">
 Test12</p>
<p dir="ltr">
 Test3</p>
<p dir="ltr">
Test4</p>
<p dir="ltr">
 &nbsp;</p>"

The content of the rt field is filled using the standard RT Editor in xpages

I have tried these method to add the rt to the email. "mail" is the html function and "rt" is the richtextitem where the content is stored

mail.addHTML(rt.getFormattedText(false,0,0));
mail.addHTML(rt.getUnformattedText();

But when I recieve the email the html is not preserved and the text is displayed without paragraphs,

How can I add the content of the richtext field to an html mail and preserve the html that is in the rt field

Thanks

Thomas

1
Per's suggestion should work if there isn't any images. Also check Tonys bean code openntf.org/XSnippets.nsf/…Fredrik Norling

1 Answers

5
votes

If you use the wrapDocument XSnippet to convert NotesDocument into NotesXspDocument, you can then call .getHTML() on the NotesXspDocument. This should give you the HTML representation of the document.

I use it to update the contents of a CKEditor field with the content from an existing backend document. See my blog post on this: http://per.lausten.dk/blog/2012/12/xpages-dynamically-updating-rich-text-content-in-a-ckeditor.html