Self hosted Email to Note

Idea

Hi I'm thinking of self-hosting Email to Note service. The idea is that we use Github Action as a server to receive email and forward it directly to the Sync Target (WebDAV, OneDrive,...) with joplin-sync-lib.

┌──────────────┐     ┌─────────────────────┐     ┌───────────────────┐     ┌─────────────────┐
│ Email Source │────→│ Trigger (pick one)  │────→│   GitHub Action   │────→│  Cloud Storage  │
│ (Gmail etc.) │     │ • Google Apps Script│     │    (this repo)    │     │ • Joplin Server │
└──────────────┘     │ • Zapier webhook    │     │  joplin-sync-lib  │     │ • WebDAV        │
                     │ • curl / any HTTP   │     └───────────────────┘     │ • OneDrive      │
                     └─────────────────────┘                               │ • Google Drive  │
                                                                           └─────────────────┘

The test

I made a test here by enter the WebDAV credentials and (optional) folder id as Github secret variables, which is then used by Github Action script. Then I run a curl command to trigger the Github Action, the email is then received in Joplin Desktop client after synchronization.

I think we can replace the curl command with some Google App Scripts (if we use Gmail), which can automate the process email receiving.

I also add some caching for Github Action, which now takes ~15s per email received (previously 1 minute).

Repository: GitHub - khuongduy354/selfhost-joplin-email-to-note

Conclusion

I'd appreciate to receive ideas from everyone, do you think it's useful for many people? Is there any cleaner approach for this ? Thank you.

1 Like

I’m the developer of Mail Archiver X which archives emails on macOS.

Emails have a surprisingly complex format. These days bugs are rare for my app. But I have a nice collection of bad emails.

How do you want to handle duplicate emails? A message ID should be unique but it’s not always the case.

Users have bad ideas™. Back in the days when Evernote was a thing I had some users save all their emails in Evernote. And some users have a lot of emails (> 1mio). Is Joplin suited for a huge number of notes?

Joplin is suited for huge number of notes because it is offline-first, data is store first in the local computer and it does synchronization gradually. Lots of mass import/export operations supported for multiple format.

Can you check this: How large can I grow my Joplin data and for how long?.

Regarding the duplicate email issue: currently each email received create a new note with a newly generated id. Do you mean spam emails, emails with similar content when you mention duplicate email?

This is a Proof of Concept, I'm still asking people whether they need this kind of self-hosting service, so I haven't invested deeply in it yet.

I meant the message id of the header of each email.