+1 vote

Is there any way, that I can just delete the attachments only and leave the content text of the email?

by (8.8k points)

1 Answer

0 votes
 
Best answer

No, it is not possible with IMAP nor POP3 protocols directly. Attachments are not stored separately from message text and headers – they are embedded inside an email and messages on the server are immutable.

You can create a new email with the same content, without attachments, and upload it to the server.

There are 2 methods that can help you with that:

IMail email = new MailBuilder().CreateFromEml(eml);
email.RemoveAttachments();

and

IMail email = new MailBuilder().CreateFromEml(eml);
email.ReplaceAttachments();

They both copy all email headers. You can find more details here:

https://www.limilabs.com/blog/remove-attachments-from-email

https://www.limilabs.com/blog/replace-attachments-in-email-message

by (297k points)
selected by
...