Script to import flagged email to devonthink

Not sure if what you’re looking for is possible with Apple Mail, as “Flagged” doesn’t seem to be a condition for rules (probably because it’s a dynamic condition of mail, rather than a fixed one, like From).

This might not be what you’re looking for, but it is possible to automatically import e-mail to DT with more complex solutions like using Python to access the IMAP account directly. If you know your way around some (advanced) scripting you can take a look at: Auto-import new mail to DEVONthink. That script could be adapted to only process flagged e-mails. Bear in mind that this requires (quite) some effort from your side to keep the script running. But alas it is possible.