Tuesday tip: Even better mail rule script

If you like our mail rule scripts for emailing yourself documents and adding them to your DEVONthink inbox or databases, you will like this new script even more. Add it to a rule in Apple Mail and give the rule a distinct name. The messages will get files into a group of the rule’s name in DEVONthink’s global inbox and all attachments in a group with the message’s name.

Automatically file messages & attachments.scpt

What is this useful for? Create multiple rules with this script attached and everything will get filed nicely into separate groups.

16 Responses to “Tuesday tip: Even better mail rule script”

  1. Andy Quin says:

    This is v helpful. Great script. Well done.

  2. Marshall says:

    Umm. Noob here. Can you tell me how I use this?

  3. Marshall says:

    I mean install? Put this to work?

  4. eboehnisch says:

    @ Mashall: You just put the script somewhere, e.g. into ~/Library/Scripts. Then create a rule in Mail.app and add the script.

  5. toph says:

    Works, but without attachments (0), any ideas ?

    Only way it works with attachment within apple mail is to import the complete inbox…

  6. eboehnisch says:

    @ Toph: The script should import the messages as well as all attachments (as separate items). Please contact our customer support and describe the problem a bit more in depth including step-by-step instructions how we can repeat the experiment? Thanks.

  7. john says:

    I am a new user … this c=sounds very handy can someone just give me a bit more detail on how to create a rule with the script please

  8. eboehnisch says:

    @ john: In Apple Mail open the Preferences window. Switch to Rules. Add a rule. As action choose Run AppleScript and select the script. The script file needs to be placed into ~/Library/Application Scripts/com.apple.com (you can open that folder from the menu for selecting the script).

  9. john says:

    thank you fro the reply … the software is amazing … i have cleaned up my whole computer

    just another quick question … when I am sending an email (macmail) and I want to attach a document that is in DevonThink is there a way to access the document from the email to attach it … I know you can do it the other way around by accessing the doc first…


  10. eboehnisch says:

    @ john: Just make a new email message, then drag the document in question over from DEVONthink into the message text.

  11. giogieri says:

    This script worked flawlessly until some weeks ago when I realised that on import from Apple Mail some attachments loose their connection to the message they belong to. In the message window they appear as sad little blue icons with a question mark inside. This happens most of the time but not always. Don’t see any pattern. It’s always possible to find the right attachment by going back to Apple Mail but this is a most inelegant solution. Any ideas?

  12. giogieri says:

    I found the solution: just have to display the message in “Best Alternative” mode, and everything is there. Sorry!

  13. Hugh says:

    I have similar problem to “toph” in this thread. The major sworks and pulls over whole message into a subfolder under Devonthink Pro inbox. The attachment is embedded in the .eml file.

    The attachment group is empty.

    Has the script been updated?
    This is using Yosemite 10.10.5, Devonthink Pro 2.8.6

    “toph says:
    September 26, 2014 at 21:41 UTC
    Works, but without attachments (0), any ideas ?
    Only way it works with attachment within apple mail is to import the complete inbox…”

  14. jneumann says:

    This is not a good support channel. Head over to http://www.devontechnologies.com/redirect.php?id=support for online help options.
    Also, check the in-app Help menu.

  15. Ulrich Koestner says:

    For everybody who is struggling to make this run (like me):
    Go to mail and open the preferences (cmd + ,) select “rules”. Either add a new rule or edit an existing one. Specify you criteria and choose “Run apple script” as action to be performed.

    In the dropdown menu where you can select the script choose “open in finder”. In the window that now opens drag and drop a copy of the script you can download on this page. Now you can actually choose the script in the same dropdown menu. Choose it and click “OK”. When asked “Do you want to apply your rules to messages in selected mailboxes?” Click “Apply”. Now it should work. Tip: To test your rules create a smart Mailbox with the same rules. Since these update dynamically you can see how the rule is working. When you have the recipe for your rule just delete the smart Mailbox afterwards.

  16. James says:

    Hi, I would like to rename the attachments with the prefix MAIL_ or add the TAG eMail.

    How could i accomplish this?