this post was submitted on 21 Jul 2023
2374 points (98.6% liked)
Lemmy.World Announcements
29079 readers
270 users here now
This Community is intended for posts about the Lemmy.world server by the admins.
Follow us for server news π
Outages π₯
https://status.lemmy.world/
For support with issues at Lemmy.world, go to the Lemmy.world Support community.
Support e-mail
Any support requests are best sent to info@lemmy.world e-mail.
Report contact
- DM https://lemmy.world/u/lwreport
- Email report@lemmy.world (PGP Supported)
Donations π
If you would like to make a donation to support the cost of running this platform, please do so at the following donation URLs.
If you can, please use / switch to Ko-Fi, it has the lowest fees for us
Join the team
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
An NNTP binding would be a bit more directly mappable, as Lemmyβs more analogous to Usenet than email. Each community would be a newsgroup. Still, NNTP and SMTP are pretty closely related, to the point that Outlook Express supported both email and Usenet. Subscribing, reading, posting, and commenting are pretty easy concepts to map, only up and downvoting are unsupported.
This is the result of a weekend teaching myself Go, using go-imap:
I can actually receive DMs in Outlook Express now! That and listing posts in a community sorted by date are about all it does, but it works!
I went with IMAP because IMAP has more open source server code. It doesn't matter much, modern IMAP actually has native threading support for example. I've modeled Lemmy as every community being a mailbox under INBOX (with INBOX being reserved for DMs). My idea was to use the flags for upvoting/downvoting (you can add arbitrary flags to IMAP, although I seem to be the only person using them). Favorites are easy (just use the marking/star/flag/whatever feature).
Subscriptions are already part of IMAP. I implemented them but I disabled them when Outlook Express tried to "reset to defaults" and almost unsubbed me from every community.
Admin stuff is also possible, technically! Removing folders would be the same as purging them (rather than unsubbing), deleting emails would be like deleting posts. Add a CardDAV server and you may even do user management!
I even came up with a scheme to do sorting (INBOX/topday/community@server.example). This is a horrible hack, but Gmail does something similar, duplicating messages across labels.
The experience taught me a lot about IMAP and I hate the protocol now. What the hell is up with message IDs changing every time the client contacts the server?
The problem with either protocol is that server-side sorting is barely implemented. Messages are cached by the client so things like scoring are impossible to implement right. Another issue is the lack of pagination, but I guess that can be solved by an arbitrary cut-off date or a limited amount of posts.
I'd also need to think of a way to fetch all replies to make the email threads work. Right now it only lists posts, it doesn't fetch comments yet.
SMTP as an input mechanism shouldn't even be that bad (as long as you make sure the reply button replies to a unique "email address" like post12345@server.example). My plan was to parse everything as Markdown (after extracting the text from HTML emails). Image attachments would be a bit harder, but I think they could work.
I think I should re-do the entire thing using direct database access rather than using the Lemmy API, because right now refreshing all folders downloads all messages on the server which quickly kills the server/hits the request limit. Maybe I'll eventually come back to this, but developing and debugging this is rather slow and painful.