Skip to content
SQL-based storage backend for go-imap. Work in progress.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Travis CI CodeCov Issues License

SQL-based storage backend for go-imap libraries.


Go 1.11 is required because we are using modules. Things may work on older versions but these configurations will not be supported.

RDBMS support

go-imap-sql is known to work with (and constantly being tested against) following RDBMS:

  • SQLite 3.25.0
  • MySQL 5.7 (or MariaDB 10.2)
  • PostgreSQL 9.6

Note: MySQL 5.7 support is deprecated since it's addition and not even strictly safe to use. Please stick to using newer versions (MySQL 8 or compatible MariaDB version) when possible.

IMAP Extensions Supported

Due to go-imap architecture, some extensions require support from used backend. Here are extensions supported by go-imap-sql:


go-imap-sql never invalidates UIDs in an existing mailbox. If mailbox is DELETE'd then UIDVALIDITY value changes.

Unlike many popular IMAP server implementations, go-imap-sql uses randomly generated UIDVALIDITY values instead of timestamps.

This makes several things easier to implement with less edge cases. And answer to the question you are already probably asked: To make go-imap-sql malfunction you need to get Go's PRNG to generate two equal integers in range of [1, 2^32-1] just at right moment (seems unlikely enough to ignore it). Even then, it will not cause much problems due to the way most client implementations work.

go-imap-sql uses separate math/rand.Rand instance and seeds it with system time on initialization (in NewBackend).

You can provide custom pre-seeded struct implementing math/rand.Source in Opts struct (PRNG field).


You can use go-imap-sql as part of the maddy mail server.


For direct access to database you can use imapsql-ctl console utility. See more information in separate README here.

go install
You can’t perform that action at this time.