Skip to content

An IMAP server library written in Go

License

Notifications You must be signed in to change notification settings

ProtonMail/gluon

Folders and files

NameName
Last commit message
Last commit date
Mar 24, 2025
Oct 9, 2023
Nov 21, 2024
Jan 16, 2025
Aug 24, 2022
Nov 14, 2023
Jan 9, 2023
Feb 2, 2023
Jan 16, 2025
Mar 24, 2025
Jul 17, 2023
Nov 21, 2024
Apr 5, 2023
Oct 18, 2024
Nov 21, 2022
Jan 18, 2023
Nov 21, 2024
Nov 21, 2024
Nov 12, 2024
Dec 6, 2023
Nov 21, 2024
Nov 21, 2024
Nov 24, 2022
Jun 2, 2023
Sep 21, 2022
Aug 17, 2023
May 30, 2022
Mar 24, 2025
May 30, 2022
Jun 2, 2023
May 30, 2022
Jan 27, 2023
Nov 21, 2024
Feb 21, 2023
Apr 23, 2024
Apr 23, 2024
Nov 21, 2024
Mar 24, 2025
Oct 24, 2022

Repository files navigation

Gluon

An IMAP4rev1 library focusing on correctness, stability and performance.

CI Status GoDoc Go Report Card License

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