Hello,
How do i replace MapiMessage attachment through index ?
For example- If single MapiMessage item has 5 different attachments like-
attach1.xls,
attach2.jpg,
attach3.pdf,
attach4.txt and
attach5.png
and we need to replace all these attachments as-
attach1.zip
attach2.zip
attach3.zip
attach4.zip
attach5.zip
All i need through index replacement of attachments. Can you please provide a sample code for this?
@hitasha
Could you please share sample input MSG and expected output MSG files here for our reference? We will then provide you more information on it.
Fwd_ This is test mail for outlook attachment.7z (598.5 KB)
Hi,
Please find attached sample MSG file. This is the source/ input MSG file. This MSG file contains 5-different types of attachment files.
I need to compress each attachment files into .zip file and then replace the attachments in MSG file.
Please provide me a working code for this task.
Kind Regards
@hitasha
Please note that Aspose.Email does not provide APIs to compress the attachments. However, you can extract the attachments from MSG file using Aspose.Email and ZIP them using Aspose.ZIP. Please read the following article.
Zip or UnZip Files in C# - Compressing and Decompressing Archives
Once you ZIP the extracted files, you can add them to MSG as attachment. Please read the following article to add attachment.
Adding Attachment
Hello,
I understand your points and I manage to extract and zip every attachments properly… My initial query is about how to attach .zip attachments using MapiMessage.
I don’t want to convert MapiMessage to MailMessage and then attach the attachments and then again convert MailMessage to MapiMessage.
Can you please assist me how to add attachments using MapiMessage?
Kind Regards,
@hitasha
Please use the attached sample project to replace the attachments using MapiMessage.
ReplaceAttach.zip (612.3 KB)