I check the attachments in the letter through the anti-virus system, if the attachment is malicious or suspicious, it must be removed from the letter and add the text that the attachment was deleted.
How can I effectively remove Content-Disposition: inline or Content-Disposition: attachment attachments? Is it necessary to collect a new letter (new email.Message object) and add attachments to it already? Can I probably somehow change the already existing email.Message object? And if it is impossible, how can you construct a new letter that can be of any complexity (you need to copy all the headers, all parts of the letter, for example, using msg.walk)?