Apple Mail Rule with Add to DEVONthink Plugin (Big Sur)

I’m currently running Big Sur and I’m trying to create an Apple Mail Rule that uses the “Add to DEVONthink” plugin to send messages that meet a certain criteria to DEVONthink, but it doesn’t look like the plugin is an option in the action menu (there are DEVONthink actions under applescripts, but not this plugin).

Is there a workaround for this?

Welcome @zebulon
No there is no workaround as mail rules don’t call plugins. You can only execute AppleScript’s (and this is an Apple decision, not ours).

Okay, thanks for the reply. I was afraid of that. I did see in another post that you can use Zapier in combination with gmail and Dropbox to get messages automatically added to DEVONthink. Which is maybe more than I wanted to setup, but I might look into that.

Have you tried the mail rule scripts?

I have tried one. So the Mail Rule options it gives me are

  • Add Links to DEVONthink
  • Add Attachments to DEVONthink
  • Add messages to DEVONthink

I tried the “add messages” option, but that didn’t seem to do anything. I don’t think the other options would help. I’m not sure if there’s supposed to be anymore options, but that’s all I see.

Is anything reported in DEVONthink’s Window > Log?

No, nothing showing up. And no new files show up in my recently added, unfortunately.

That option does work, though - I’m using it. Is Mail allowed to control DT? (see the appropriate setting in the system security preferences, under automation, I think).

I do see the setting, but it’s for DEVONthink to control mail, I think. In any case it is checked.

But since it’s working for you, maybe there’s another setting I need to change?

It needs to go both ways:

Once you set that up, I’d guess things should work :slight_smile:

(and wow does that picture alone show the level of trust I have in DEVONtech)

Ha! so true.

For some reason mail doesn’t even show up as an option under automation. I wonder if I need to set a preference somewhere else before it will show up there

This is controlled by the operating system and is unfortunately (still) buggy.

I personally have seen the issue where I couldn’t get macOS to re-request permissions after being reset.

Oh, so maybe this will show up later with an update. Hopefully!

Yes, hopefully but Apple’s record has been pretty poor on handling such things lately.

You might find this article on helpful. tccutil reset AppleEvents will apparently reset the permissions for Automation. Perform the step with any relevant applications closed. I think I would make a backup of /Users/*yourusername*/Library/Application Support/ beforehand. It’s possible that if resetting Automation permissions leads to problems, putting back that file would return you to the status quo. I’ve not tried this, and you take these steps at your own risk.

That is the exact operation I was referring to. It made no difference on one of my machines I was having an issue with, even when attempting this in safe mode (and a deeper method I will not be linking as it’s possible to cause real problems).

However, your machine is your machine, so you can try it if you’d like.

Aye, I thought it might be. I still think it might be worth a try :man_shrugging: I presume one could even add the appropriate lines in the tcc database, but having looked at its structure it’s obvious that I lack the requisite knowledge to do such a thing. Possibly deleting the whole database might also be an option.

Have the same issue as the OP and the Mail->DEVONthink 3 line item isn’t showing in the Security & Privacy -> Automation list box either. (AppleScript from Mail -> DT3 not working)

Wondering if maybe you enabled that Automation permission prior to upgrading to Big Sur?

Also, am seeing resistance encountered when poking at that TTC db

$ sudo ls -lsa Library/Application\ Support/
ls: : Operation not permitted

I’m running 2 macs; one is on an upgrade installation of Big Sur, the other was a clean install though. I was running DT prior to upgrading on the upgraded machine, and had provided the appropriate automation permissions prior to upgrading. But everything works just fine on the clean install too.

TCC doesn’t liked to be poked at :wink:

You could try this in Terminal after quitting Mail…

sudo tccutil reset AppleEvents

Then try dragging and dropping an email from Apple Mail into DEVONthink.
However, there’s no guarantee it will work as the tccutil reset doesn’t always work.