I have an eml file with 3 attachements which I open, then delete the middle attachement (pos 1) and finally save the EML with a different filename. Unfortunately the result EML still contains all attachements.
var msg = MsgReader.Mime.Message.Load(new FileInfo("C:\Users\XXXX\Downloads\test.eml"));
msg.Attachments.RemoveAt(1);
msg.Save(new FileInfo("C:\Users\XXXX\Downloads\test_clean2.eml"));
Guessing the issue is in the Save method on the Message class where you either save it as raw (I think that's the original message) when changes are detected on attachements or reconstruct the message when no changes are detected on the attachement. I think this condition should be inverted.
I have an eml file with 3 attachements which I open, then delete the middle attachement (pos 1) and finally save the EML with a different filename. Unfortunately the result EML still contains all attachements.
var msg = MsgReader.Mime.Message.Load(new FileInfo("C:\Users\XXXX\Downloads\test.eml")); msg.Attachments.RemoveAt(1); msg.Save(new FileInfo("C:\Users\XXXX\Downloads\test_clean2.eml"));
Guessing the issue is in the Save method on the Message class where you either save it as raw (I think that's the original message) when changes are detected on attachements or reconstruct the message when no changes are detected on the attachement. I think this condition should be inverted.