Automate Apple Mail to add details to Things 3

Hi!

I’m trying to make an applescript that runs when I receive a mail from my local library. I get an confirmation that I’ve lent a book and when it should be returned.

I then want the script to get the title and date that is stated in the mail and then add a todo in Things 3 with the date as due date and also a scheduled date for 1 week earlier. And also the title of the book as the title of the todo.

I’ve been looking around for something like it but can’t really get it to work, the problem it to extract the information from the mail itself.

The mail looks like this
I want the script to take the title from “Titel:”
And the due date from “Återlämningsdatum:”

2017-03-22 18:43:55
MALMÖ STADSBIBLIOTEK
Stadsbiblioteket
Låntagarnummer: **********
Utlån

Titel: xxx
Exemplarnummer: xxx
Återlämningsdatum: 2017-04-19

Any ideas?

2 Likes

Does it have to be an applescript? You should be able to do this in javascript?

Hi, thank you for your reply.

It doesn’t have to be in applescript, I just know a tiny bit about AppleScript and nothing about java.

Be Thomas

Have you looked at Zapier for parsing the email and sending the info to things?

Hi

They are unfortunately using mail to Things so it doens’t support any due dates or schedules. It just appears in my Things inbox instead. So that doesn’t really do what I want to do.

br Thomas