问题
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">
</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:
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
来源:https://stackoverflow.com/questions/20346252/how-to-add-html-stored-in-a-richtext-item-to-an-htmlmail-in-xpages