Reputation: 398
I have an XPage with a RichText control and I need to grab the content of it and send it via email.
I have it working by using getComponent("rtfQuestion").getValue();
and appending it to my HTML email:
var body = memo.createMIMEEntity();
var stream = session.createStream();
var url = context.getUrl();
url.removeAllParameters();
msg = "The response linked below has been submitted.<br/><br/>"
var info = "Please click <a href='" + url.toString()+ "?documentId=" + doc.getDocument().getUniversalID() + "&action=openDocument";
info = info + "'>here</a> to view the new response." + "<br/><br/><fieldset><legend>Answered by " + @Name("[CN]",doc.getItemValueString("Originator")) + "</legend>" + getComponent("rtfQuestion").getValue() + "</fieldset>";
// Set content of Body field as MIME type
stream.writeText(info);
body.setContentFromText(stream, "text/html; charset=iso-8859-1", 0);
memo.send();
The problem I have is when user adds an Image using the "Insert Image" action from toolbar then the MIME Content-Type is "Content-Type: multipart/related" and image(s) are not been sent.
What could be the best way of getting the RichText content and send it via email?
Thanks in advance.
UPDATE
This is what I get from getComponent("rtfQuestion").getValue()
:
This is the Body content from received email:
Field Name: Body
Data Type: MIME Part
Data Length: 977 bytes
Seq Num: 1
Dup Item ID: 0
Field Flags: SIGN SEAL
"MIME-Version: 1.0
Content-Type: text/html; charset=iso-8859-1
Please click <a href='http://tristan.corp.teradyne.com/applications/ask-b30.nsf/xResponse.xsp?documentId=056C62166F3A8B3E85257D490070264C&action=openDocument'>here</a> to view the new response.<br/><br/><fieldset><legend>Answered by Notes Dev1</legend><p dir="ltr">
Lorem ipsum dolor sit amet, quot mollis utamur ius ad, rebum timeam oporteat sea ea. Mea alii iriure at, ne tale probatus usu. Sonet consulatu dignissim ad per. Ne munere doming vim, ad sale everti voluptaria has.</p>
<p dir="ltr">
Labore ceteros facilisi est in. His et regione phaedrum. Eam apeirian phaedrum vituperatoribus in, ei sea sint latine nominavi, est in rebum iisque nostrum. Utinam impedit ea sit, his cu agam probatus deserun</p>
<p dir="ltr">
<img alt="" src="/applications/ask-b30.nsf/xsp/.ibmmodres/persistence/DominoDoc-18E2-Content/1.PNG" style="width: 249px; height: 172px;"></img></p></fieldset>"
Upvotes: 1
Views: 270
Reputation: 21709
Use the emailBean by Tony McGuckin instead: http://openntf.org/s/emailbean-send-dominodocument-html-emails-cw-embedded-images-attachments-custom-headerfooter
Upvotes: 3