Mail applescript not working

mail applescript not working (for me)
Using Apple Mail: v14.0 (3654.20.0.2.21

Email From: New York Times
Objective: File in Devon and send to Trash

Have tried (non modified scripts):
Run Apple Script: Mail Rule - File messages & Attachments
Run Apple Script: Mail Rule - File messages & Attachments hierarchically
Run Apple Script: Mail Rule - Add messages to DevonThink
Plus Move Message to mailbox: Trash

Result: messages are moved to the trash but not to DT.

When I remove the trash rule the message does not go into the Trash nor does it get moved to DT.

Suggestions?

1 Like

Is anything reported in DEVONthink’s Window > Log?

Nothing.

Does DEVONthink have Full Disk Access and any Automation permissions allowed in System Preferences > Security & Privacy > Privacy?

Question: What should be the result for the Add messages to DevonThink vs File messages & Attachments? Or what’s the difference between the two?

Yes. Confirmed that it has Full Disk Access and Automation permissions.

Restarted computer and all apps. It is now working.

Question: What should be the result for the Add messages to DevonThink vs File messages & Attachments? Or what’s the difference between the two?

Restarted computer and all apps. It is now working.

Glad to hear it.

From Help > Documentation > Automation > Apple Mail Rules…

Not so fast. Not working again. Just setup a new rule, for a brand new incoming message, that placed the email in the trash but did not place it in DT. :tired_face:

I have previously read that help file. Thank you. But I still don’t understand what is the difference between Add messages and File messages.

I think that it should be:

File Messages only
File Messages + attachments
File Messages + attachments + recreating mailbox structure (whatever that means)

1 Like

Before I jump out of a window over this, which would not do much because I am on the first floor, one other thing. I do notice that the Mail changes the rule on me, I create:

1 Run Apple Script
2 Move message to Trash
Ok, to close

Open again and the rule is:
1 Move message to Trash
2 Run Apple Script

Screen Shot 2020-12-01 at 15.14.19

Don’t know if it makes a difference because when I take out the Trash rule the email is not transferred to DT.

Maybe it is good news, but I did a Shift + Control + Option + Command + M….resulting in a folder in DT titled All Inboxes. With about 150 emails. I may have to automate or setup a routine that so that once a day those keystrokes are pressed. Have to think about the workflow from this scenario. But the scripts are definitely not reliable.

We have no control over Mail rules or the order of items in them. That has nothing to do with our scripts. That’s purely an Apple question.

Why aren’t you using the View > Import sidebar to archive the mailbox or import emails?

Why not view>import:

I wanted to use rules to do a preselection of my messages in Mail because I can also read them on my iPhone before sending them to DT. I was testing the DT script to make sure that the jump from Mail to DT worked before doing anything else, but it does not work so I will discard that idea.

Also, view>print is kind of blind. I cannot see the content of the message before deciding whether I want to import it or where it needs to be filed, As has been mentioned before, it would be nice to have IMAP integration. This area of DT seems like a candidate for improvement.

None-the-less, I am happy to be able to import all my past years and current stream of emails so that they can be indexed and useful. I kept them all thinking that someday they would be useful and now they may be. Thanks.

I really need to automate the move of one email from Apple Mail to Devon for my workflow. It is an instance where I send myself a BCC: message that should then be picked up by a rule to go to the Global Inbox, ideally to the inbox of a specific database but I will be happy if it makes it into the GI. I reset the DevonThink_BigSur.mailbundle, restarted the Mail, all the permissions have been established but it is a no-go. I have Keyboard Maestro, Hazel, Apple Scripts, Hook and Automator. Can anyone suggest a method (script) to automate that simple act, moving an email from one location to the other consistently? Please. Your suggestions are welcome. Thank you.

1 Like

Moving it from one place to another… where?
From one location to another in DEVONthink… or?

Moving from Apple Mail inbox to Devon Global Inbox.

Clicking on the Devonthink_BigSur folder in the Devonthink_BigSur.mail bundle I was presented with a Terminal window informing:

The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
….
-bash: /Users/name/Library/Mail/Bundles/DEVONthink_BigSur.mailbundle/Contents/MacOS/DEVONthink_BigSur: cannot execute binary file

Can this be the problem in the script?

I looked at https://support.apple.com/en-us/HT208050 but don’t want to execute the instructions there without understanding the consequences. Any feedback?

Why are you clicking on this file?

1 Like

Yes, why are you messing about in the internals of the Apple Mail plugin?

1 Like