sqlmail

package module
v0.0.0-...-3008fd9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-sqlmail

Travis CI CodeCov Issues License

SQL-based storage backend for go-imap and go-smtp (not yet) libraries.

Building

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-sqlmail 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-sqlmail:

Maddy

You can try go-sqlmail as part of maddy mail server. Currently it is not merged into upstream yet so here is where you should get code from: https://github.com/foxcpp/maddy/tree/sqlmail

You need to execute this command prior to building to get lastest development version:

go get github.com/foxcpp/go-sqlmail@dev

Here is minimal example for testing, using SQLite (you need CGo for SQLite!):

imap://127.0.0.1:1993 {
    sql sqlite3 maddy.db
    insecureauth
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserAlreadyExists = errors.New("imap: user already exists")
	ErrUserDoesntExists  = errors.New("imap: user doesn't exists")
)

Functions

This section is empty.

Types

type AppendLimitBackend

type AppendLimitBackend interface {
	appendlimit.Backend

	// SetMessageLimit sets new value for limit.
	// nil pointer means no limit.
	SetMessageLimit(val *uint32) error
}

AppendLimitBackend is extension for main backend interface (backend.Backend) which allows to set append limit value for testing and administration purposes.

type AppendLimitMbox

type AppendLimitMbox interface {
	CreateMessageLimit() *uint32

	// SetMessageLimit sets new value for limit.
	// nil pointer means no limit.
	SetMessageLimit(val *uint32) error
}

AppendLimitMbox is extension for backend.Mailbox interface which allows to set append limit value for testing and administration purposes.

type AppendLimitUser

type AppendLimitUser interface {
	appendlimit.User

	// SetMessageLimit sets new value for limit.
	// nil pointer means no limit.
	SetMessageLimit(val *uint32) error
}

AppendLimitUser is extension for backend.User interface which allows to set append limit value for testing and administration purposes.

type IMAPUsersDB

type IMAPUsersDB interface {
	UsersDB

	// GetUser is same as Backend.Login but doesn't
	// performs any authentication.
	GetUser(username string) (backend.User, error)
}

type UsersDB

type UsersDB interface {
	// CreateUser creates new user with specified username.
	//
	// No mailboxes are created for new user, even INBOX.  This should be done
	// manually using CreateMailbox.
	//
	// It is error to create user which already exists.  ErrUserAlreadyExists
	// will be returned in this case.
	CreateUser(username, password string) error

	// DeleteUser deletes user account from backend storage, along with all
	// mailboxes and messages.
	//
	// It is error to delete user which doesn't exists.  ErrUserDoesntExists
	// will be returned in this case.
	DeleteUser(username string) error

	// SetUserPassword updates password of existsing user.
	//
	// It is error to update user which doesn't exists.  ErrUserDoesntExists
	// will be returned in this case.
	SetUserPassword(username, newPassword string) error
}

UsersDB is additional backend interface that allows external code to perform administrative actions on backend's storage related to users.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址