SaneBox -> DEVONThink

Just started using SaneBox for the first time. If you don’t know already (MacSparky talks about it all the time :stuck_out_tongue_winking_eye:) SaneBox is basically that looks at your past email behavior and intelligently guesses which email is important to you.

SaneBox also has a feature where you can create your own folders, so I created one called SaneReceipts. As I add receipts to this folder w/in my gmail, it will get smarter at identifying which emails are receipts.

That got me thinking, :thinking:. Well, if I have SaneBox already organizing my receipts into a gmail folder (Gmail calls them “labels”) then surely I could create an automation that adds those emails into DEVONThink. Just make an automation that watches the folder, runs whenever a new email is added to the folder, and runs a script which copies the email into DT. Easy right?

Well, that’s what I’m figuring out now.

I tried rules in Apple Mail, but it seems that new email in a folder is not one of the triggers. Also tried Gmail rules and it looks like the same problem.

SaneBox has a feature where identified emails can also be forwarded to an email address of your choice, but alas, it doesn’t seem that DT has a forward to DT inbox feature.

Can anybody think of another way I can connect SaneBox and DT? I think it would be helpful for everyone if we can figure out an automation that intelligently identify’s receipts in our email and automatically archives them in a database for us.

Ask Sanebox to add the email address for DT for you. I needed them to add one for flighty app for my system and they did.

I don’t use Apple Mail or Devon Think, but here’s a few ideas that might work.

Option 1

A bit Rube Goldberg, but maybe forward trigger a forward to a web integration service like IFTTT/Integromat/Zapier. Have that dump the email into a cloud storage system (usually Dropbox, Google Drive or Box) in whatever format is available.

With that storage syncing to your Mac, have Folder Actions, Hazel, or Keyboard Maestro move the new content to wherever DT expects incoming content to be to be processed.

Option 2

Another option would be to run with your original plan on a set schedule rather than triggered by arrival. E.g. Once per day an AppleScript is triggered that interacts with Mail and exports the mails that have arrived in the receipts folder since it was last run.

Option 3

Gmail supports scripting. I used it in the past to write my own advanced email sorting rules when Gmail’s own rules were just not up to the job. There is at least a schedule trigger, but there may also be others you could use - I haven’t used it for quite a few years now. But setup whatever trigger works best, run a script to process the labelled mails, exporting them to Google Drive.

At that point you’re back to syncing, etc. as per option 1.

Hopefully, something above will give you some ideas.

1 Like

I love these ideas! I’ll try option 3 first.

I don’t think that DT has the ability to import via forwarding to an email address. Not according to their forum.

Good to know. I don’t use DT so had no idea if email was an option path into it

Hi,

You could set up a Mail rule that identifies Messages with keywords (Receipt, Invoice etc) then runs an AppleScript to copy that mail item and/or attachment to Devonthink.

Devonthink provides a number of different Applescripts that could be used to help you out.

Iain