Separate/import e-mail attachments for better search V2

I don’t want to discourage you. But doing something like that in AppleScript alone is probably a very demanding endeavor.

Some time ago, I tried doing that in JavaScript (which is considerably easier to use than AS for string operations). Having delved into the different ways e-mails can be structured, I gave up.

E-mail is a mess. Tons of things to consider (inline vs. attachment, multipart/mixed, multipart/alternative, header encodings base64 or binary). It is a lot easier to use a library that provides you with access to the different parts of an e-mail, which presumably the original script(s) do.

So, rather than reinventing the wheel, I’d suggest you stick with this/these script(s), even if they need external tools like Python. With AS or JXA, you’ll simply end up writing a probably buggy e-mail parser.

There’s a node project (written in JavaScript) that has > 1000 LOC and relies on other libraries.