How to add html stored in a richtext item to an HTMLMail in Xpages

萝らか妹 提交于 2019-12-14 00:27:55

问题


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:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!