Add Inline images to Lotus notes mail - lotus-notes

I have an application which reads the eml and convert it to NSF mails using C API. I am able to add HTML Body to it using NSFMimePartAppendStream method but my problem is how to add inline images to it.
By using method MailAddMessageAttachment attachment are getting added as normal attachment but how should map the Content id to it. Can any one please explain how to add inline images to mail body?
Regards,
HAseena

Issue is solved using MIME Content, reading the mime entirely with attachmenst and inline images "MIMEStreamWrite"

Related

Issue Getting Attachments from Email in Microsoft Flow/Power Automate

I'm currently building a new ticketing system for my workplace. When an email is received it generates a ticket number and few files in a SharePoint document library. One of those folders is "Attachments" where the flow I am building is supposed to put any attached documents. As far as I can tell I've followed other guides to the tee, however it renders the attachments un-openable. After downloading the files it did make and opening them in Notepad++, the content of the files is completely different and I can't seem to figure out why... I've been testing mostly with *.docx files, but it does the same for other file types as well. Please see attached screenshot of the attachments getter part of the flow. Any support is greatly appreciated!
Attachment Getter Screenshot
Note: This is how the guides told me to do it, however I did try changing the "File Content" box to "Attachments Content" instead of "Current Item" from the dynamic content menu to no avail.
Try use attachments content directly:
How to save Email Attachments to your SharePoint Document Library
Can you try to get the file content.
File content should help getting attachment. You will have to recreate a file though.
For this problem, please check if you have set the value of Include Attachments in the trigger to Yes.

How to upload html document using Docusign REST API

I have my code working to upload a PDF document, but I am trying to get it to upload an HTML document and having trouble. My code that works for the PDF document is this:
$documents = new Document();
$documents->setName($doc_name . '.pdf');
$documents->setDocumentId(1);
$documents->setFileExtension('pdf');
$file = file_get_contents($file_url);
$documents->setDocumentBase64(base64_encode($file));
But when I try to do this with an HTML document it fails. My HTML attempt uses this:
$documents = new Document();
$documents->setName($doc_name . '.pdf');
$documents->setDocumentId(1);
$documents->setFileExtension('html');
$documents->setDocumentBase64(base64_encode($html));
When I try this using the REST API Explorer I get this error message:
System was unable to convert this document to a PDF. Unable to convert Document(SampleHTML) to a PDF. Error: UserId:xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx IPAddress:54.213.184.61 Source:ApiRESTv2:FileType UNKNOWN is ineligible for conversion.
I have read that html is an accepted file type, so I am pretty sure this is possible. I could cover to PDF on my server and send, but would rather pass that off to Docusign.
Any help is greatly appreciated.
Thom
The DocuSign platform does indeed accept multiple document formats, however there may be a difference between what the DS Apps accept and what the API accepts. The list of supported document types that you can send through the DocuSign Console can be found here:
https://support.docusign.com/guides/ndse-user-guide-supported-file-formats
However I'm not sure if .html is an accepted file format when sending through the API. I thought there might be security issues with that but not positive at this point. In either case, even though you are setting the fileExtension property it looks like you are still sending a document with a filename that ends with .pdf, have you tried removing that or changing to .html?

Append Rich Text Item to MIME

I have a submit only XPage based form that has an inputRichText field for storing screenshots and a multi file upload (using the XPages Multiple File Uploader from OpenNTF) for uploading one or more attachments. When submitted I need both the screenshots and the attachments to appear in a single rich text field which will be accessed via the Notes Client only (non XPages).
Currently the form stores the attachments and screenshots in separate fields. I have tried appending one field to the other on save (using SSJS in the submit button, however because the Screenshots are stored as MIME and the attachments as NotesRichText, it is not letting me do it.
Is there some way (preferably in SSJS) that I can convert either the MIME to RichText or vice versa so that I can append one field to the other? I have tried searching for various solutions to no avail, as well as trying different file upload controls from OpenNTF.
Ideally I need something like this to work:
var rtItemAttachments:NotesRichTextItem = docTo_Backend.getFirstItem("attachments"); //This is the field I want everything in
var rtItemFiles:NotesRichTextItem = docTo_Backend.getFirstItem("uploadedFiles");
rtItemAttachments.appendRTItem(rtItemFiles); //Fails on this line
docTo_Backend.removeItem("uploadedFiles");
Speak after me: there is no RichText in the web, all there is is MIME.
You can set the RT field to store its content in MIME (a property). This makes things much easier.
To stitch things together you need to stick with MIME. These are roughly the steps
Get the text and images as MIME
Get your attachments as stream (the embeddedObjects has a method for that)
Convert the stream to BASE64 and create a new mime-part with it. (Looking at an attachment eMail source someone sent through the internet should give you a pretty good idea how it looks like)
You end up with:
MimeHeader
MimePart for Text (HTML)
MimePart for Screenshots (if they are not inline images in html)
MimeParts for attachments
The special effect: if you add to the HTML with links to the attachments, it looks nicer.
Of course the BIG question: WHY?
You could simply design a Notes form that has two fields, no need to fold it into one. Hope that helps.
A good piece of code to look at to understand the MIME stuff is the OpenNTF eMail bean

When generating HTML email using MIME, can attachments be displayed in the Lotus Notes email body?

I've created a html formatted email containing a table and want attachments to appear in rows in the table. I can't manage to get the attachments to appear in the body of the email at all, instead they come through (in our Lotus Notes 8.5.3 client) as attachments all grouped in the header under the attachment twistie.
Is there any way for the attachments to display in the body of the email instead of the header?
(Updated Jan 20, 2014)
For reference, I looked for sample methods for adding attachments. Mark Leusink here and Tony McGuckin here posted great snippets for building HTML/MIME emails, so I used these as a starting point, but couldn't find anything to get the attachment into the body. Stephan has clarified why that is in his response below.
Mime doesn't contain attachments in message bodies, so they won't show up. However with a little trickery you can get what you want:
add another attachment containing an icon to be shown for the attachment. One generic or one each
in your table construct a href followed by img src pointing to image and attachment
you can read more about the URL format here
http://en.m.wikipedia.org/wiki/MIME
Bonus track: there is a notes item to stop attachments to be shown (can recall which one) If you smuggle that in as header...
Stephan has already pointed you in the right direction, but I'll just add a bit more detail in case others stumble upon this question.
You need to create a multipart MIME structure -- specifically multipart/related -- containing an HTML part (Content-Type: text/html) and one or more attachment parts. Each attachment part should have a Content-ID header with a unique identifier.
Your HTML part will usually have at least one anchor element corresponding to each of the attachment parts. The href attribute can refer to the attachment by Content-ID. Here's an example:
someFile.ext
It's important the substring after "cid:" is an exact match of the Content-ID header of the corresponding attachment part. That's how the anchor and the attachment part are tied together.
As Stephan said, http://en.wikipedia.org/wiki/MIME is a good reference. However, the MHTML page (http://en.wikipedia.org/wiki/Mhtml) might be a better starting point. MHTML is a subset of MIME that focuses on multipart/related and HTML.

Cannot Extract Images from Lotus Notes using Java API

I am working on a Data extract from a Lotus Notes Application. It stores legal documents which may have attachments and images (not mails). I want to convert notes documents to HTML. While importing the data using java API I am able to extract Text, Attachments etc but when it comes to images I am not able to extract them. I did some research and found about two approaches
1) To extract the document using generateXML() method. But the generated document contains a picture tag which has a referenece of location on Notes Domino server. But I want the image so that it can be included in the HTML document.
2) By extractinh as MIME Entity. When I try to get images using getMIMEEntity("Body") or any other field I do not get any image and It always return null.
There is question (Extract inline images from Lotus Notes using Lotus Notes Java API) which deals with this but It does not answers conclusively and its dormant for a long time.
Please help, I am working on it for a couple of days still I cannot import images. Thanks in advance.
In Lotusscript you can first Extract file to your local system/ Server and than export in excel by using that code below.
' Loop through all attachment/document (By creating attachment object)and save Image to some path on server/local 'system(strSaveasPath)
Call object.ExtractFile( strSaveAsPath)
' Now Activate excel row:column range where you wnat to insert image
xlApp.Range("1:1").Activate
xlApp.ActiveSheet.Pictures.Insert(strSaveAsPath)

Resources