I’m facing an issue with handling attachments. The scenario is given below,
- I’ve an email (mail A) which has an attachment, the attached email (mail B) have 1 more attachments (some file types like pdf, doc, xls etc)
- In outlook I open the attached email (mail B) and in outlook ribbon I’ve an action button.
- When I click on the action button I’m checking if the attachment is embedded attachment then I’m removing it from the mail body and saving it to local disk. Ex. I’ve tried both
safeMailCopy.Attachments.Item(i).Delete();
and,
safeMailCopy.Attachments.Remove(i);
.. ..
safeMailCopy.SaveAs(Path.Combine(Settings.Instance.DocumentToAddDirectoryFullName,
messageFileName));
but when I open the locally saved copy then I can see the attachments still there in the mail, it’s not getting removed.
But if I’ve a regular email with attachments then I can remove the attachments and save it locally without any issue.