https://github.com/protonmail/gluon
An IMAP server library written in Go
https://github.com/protonmail/gluon
go golang imap imap-server imap4 imaplib proton protonmail
Last synced: 5 months ago
JSON representation
An IMAP server library written in Go
- Host: GitHub
- URL: https://github.com/protonmail/gluon
- Owner: ProtonMail
- License: mit
- Created: 2022-05-03T12:57:46.000Z (over 3 years ago)
- Default Branch: dev
- Last Pushed: 2025-05-12T09:43:19.000Z (5 months ago)
- Last Synced: 2025-05-12T10:48:41.818Z (5 months ago)
- Topics: go, golang, imap, imap-server, imap4, imaplib, proton, protonmail
- Language: Go
- Homepage:
- Size: 97.6 MB
- Stars: 497
- Watchers: 12
- Forks: 33
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: COPYING_NOTES.md
Awesome Lists containing this project
README
Gluon
An IMAP4rev1 library focusing on correctness, stability and performance.
# Demo
The demo server can be started with:
```
$ GLUON_LOG_LEVEL=trace go run demo/demo.go
DEBU[0000] Applying update update="MailboxCreated: Mailbox.ID = 0, Mailbox.Name = INBOX" user-id=ac8970c5-cdb7-4043-ad85-ad9b9defcfb8
DEBU[0000] Applying update update="MessagesCreated: MessageCount=0 Messages=[]" user-id=ac8970c5-cdb7-4043-ad85-ad9b9defcfb8
INFO[0000] User added to server userID=ac8970c5-cdb7-4043-ad85-ad9b9defcfb8
DEBU[0000] Applying update update="MailboxCreated: Mailbox.ID = 0, Mailbox.Name = INBOX" user-id=a51fad46-9bde-462a-a467-6c30f9a40a63
DEBU[0000] Applying update update="MessagesCreated: MessageCount=0 Messages=[]" user-id=a51fad46-9bde-462a-a467-6c30f9a40a63
INFO[0000] User added to server userID=a51fad46-9bde-462a-a467-6c30f9a40a63
INFO[0000] Server is listening on 127.0.0.1:1143
```By default, the demo server includes two demo users, both with password `pass`.
The first has addresses `user1@example.com` and `alias1@example.com`.
The second has addresses `user2@example.com` and `alias2@example.com`.Once started, connect to the demo server with an email client (e.g. thunderbird) or via telnet:
```
$ telnet 127.0.0.1 1143
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IDLE IMAP4rev1 MOVE UIDPLUS UNSELECT] 00.00.00 - gluon session ID 2
tag login user1@example.com pass
tag OK [CAPABILITY IDLE IMAP4rev1 MOVE UIDPLUS UNSELECT] Logged in
tag append inbox (\Seen) {14}
+ Ready
To: user@pm.me
tag OK [APPENDUID 1 1] APPEND
tag select inbox
* FLAGS (\Answered \Deleted \Flagged \Seen)
* 1 EXISTS
* 1 RECENT
* OK [PERMANENTFLAGS (\Answered \Deleted \Flagged \Seen)] Flags permitted
* OK [UIDNEXT 2] Predicted next UID
* OK [UIDVALIDITY 1] UIDs valid
tag OK [READ-WRITE] SELECT
tag fetch 1:* (UID BODY.PEEK[])
* 1 FETCH (UID 1 BODY[] {32}
X-Pm-Gluon-Id: 1
To: user@pm.me)
tag OK command completed in 1.030958ms
```# Changing DB schema
Do not forget to re-generate ent code after changing the DB schema in `./internal/db/ent/schema`.
```
pushd ./internal/db/ent && go generate . && popd