Python script to add emails from GMail to the Inbox

Hi all,

I created a Python script to add emails from GMail to the Inbox in Dynalist. The URL of the project is https://github.com/siancu/gmail2dynalist

I first tried a solution based on IFTTT and it didn’t work because they removed the GMail integration. Then I saw that it’s possible to do something using Zapier but that solution didn’t work for me either (I wanted to automatically add the starred messages to the Inbox and it only added some of them).

So, since I’m a programmer, I decided to fix the issue by myself.

The script currently adds only the starred emails to Dynalist but it can be changed to look for other labels as well. Please have a look at the README and at the code itself as it is quite self-explanatory IMHO.

It creates a new entry in the Inbox with the email subject as title and the message URL as a note.

It also stores the IDs of the messages that were sent to Dynalist in a SQLite db so that they are not posted multiple times.

For now the script has to be run manually. But I plan to add a cron-like functionality to it and have it run on some cheap VPS somewhere.

(And I need to add some logging …).

Please note that the script requires Python 3.

I hope it will be useful to somebody. If you have any questions or feature requests, please open a GitHub issue or comment here directly.

7 Likes

Cool. I love it when people expand on Dynalist.

What is the advantage of using this as opposed to using the dynalist clipper?

I can only see one and that is that it works on mobile. Is there something I am missing? I use gmail for private and outlook for work. Could it be expanded to work on outlook (for web)?

Did you try this:

Doesn’t it work anymore? (I use microsoft flow for work and the dynalist clipper for private emails so I haven’t tried in a while)

My main reason for developing this was that I wanted an automated way of quickly adding emails to Dynalist. So, my ideal workflow would be to star the email in GMail and then, a few minutes later, for it to appear in Dynalist. For the last part to work I would need my script to run every 5 minutes or so. I haven’t implemented that part yet (real life got in the way).

What would be your use case for Outlook? GMail has an API and I don’t know if Outlook has one as well.

I looked into IFTTT, but they removed the GMail integration a while ago (they have some generic email integration but it didn’t work for my use case - see the other reply). That’s the main reason why I went with my script (and also because I wanted to play a bit with Python, SQLite and Dynalist).

1 Like

Same as for gmail. Flag an email and let it appear in Dynalist after a minute or so. I works for me with Microsoft flow. But it would be simpler with one script to rule them all.

With regards to the timing, isn’t that easily solved with cron? That is just tell cron to run the script every 5 minutes? I would run it every 1 minute, but then I am a little impatient.

I can have a look and see if Outlook web has some sort of API.

Yes, using cron directly would be one option. Another would be to build this functionality directly into the script with a configurable interval.

1 Like

Yeah that would be great.

Integrated would be more userfriendly ofc.