Free Support Forum - aspose.com

Include inline attachment while creating message file

Hi,
Does aspose provide options to create message file with embedded files? Using following link, I am able to include regular attachments only.

Regards,
Balmukunda

@Balmukunda

I suggest you to please visit the following link for your convenience to add inline attachments in MSG.

Thanks, it worked.

I have one more questions.
I have RtfCompressed data(in bytes) which comes from other sdk. Is it possible to use this value to render the body while creating message file?

@Balmukunda

We will need a working sample project to analyze this before sharing any comments on this.

Hi,
Sample utility and pst file are attached.PstProcessingUtility.zip (5.0 MB)

https://drive.google.com/drive/folders/1oKeluusNtO84F3SyM6tOTlq7ZJY3WF5b?usp=sharing

Also above solution “How to Add an inline image as attachment in MailMessage/ MapiMessage”
works if message body type is HTML. How to handle same for RTF formatted body as I am now able to get decompressed rtf body from RtfCompressed data. ?

In above utility, following code decompressed the RtfCompressed data.

                var decomp = new RtfDecompressor();

                using (System.IO.MemoryStream ms = decomp.Decompress(xstMessage.RtfCompressed, true))
                {
                    ms.Position = 0;
                    byte[] rtfDecompressed = ms.ToArray();
                    rtfBody = Encoding.UTF8.GetString(rtfDecompressed, 0, rtfDecompressed.Length);
                }

@Balmukunda

We need to investigate the requirement for adding inline attachment to RTFDecompressed data and I have added an issue with ID EMAILNET-39948 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.