On Thu, Apr 30, 2020 at 08:54:25AM +0200, Angel M Alganza wrote: > [...] I've been looking for ways to remove the text/html part [...] > > Is there an automated way that you know of to get that done? Or do > you know of any third party program that could help me out?
Python and some other programming/scripting languages have built-in or third-party email handling libraries that can be used to iterate over messages in a mailbox (mbox, maildir, MH, etc), processing each message in turn. Unfortunately, one of the weaknesses in Python's email handling (which might be related to some ambiguities or flaws in the RFCs on which they are based - I'm not sure) relates to the problem of identifying a "primary" (for want of a better word) text/plain part. So, if you just want to remove text/html parts from each message that also has a text/plain part, you'll probably find Python adequate. But if your use case involves being sure that your script has correctly identified the "primary" text/plain part, then you may have to work around shortcomings in Python's email objects/functions. If you come up with a solution that works for you, please post a follow-up in this thread, ideally with a copy of your source code (or a link to it) so that others can benefit. I would be very interested to see your approach. Good luck! -- A: When it messes up the order in which people normally read text. Q: When is top-posting a bad thing? () ASCII ribbon campaign. Please avoid HTML emails & proprietary /\ file formats. (Why? See e.g. https://v.gd/jrmGbS ). Thank you.