imap

package module
v0.0.0-...-1e29585 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2015 License: MIT Imports: 8 Imported by: 0

README

go-IMAP Logo

Go IMAP Server

Barebones IMAP4rev1 server for golang. Designed for integration into a backend app to provide email client access.

Features a simple API for implementing your own email storage by implementing golang interfaces. Currently a dummy (in-memory) storage is included, with plans to include MySQL storage. This would make it simple to integrate into a backend application to allow users to drag-drop emails into the application, without messing around with maildir.

Although it would be possible to implement and plug in a maildir storage interface, that would defeat the purpose of this project and there are much better, tried and tested open source and commercial solutions that have been around for a long time (Courier, Dovecot etc). The goal of this project is to provide simple IMAP access to some kind of existing system without the overhead of installing a full-blown IMAP/POP3 mail server.

NOT READY FOR PRODUCTION USE

Currently only plaintext authentication is implemented. This is really bad, don't use it in any kind of environment where actual passwords or sensitive emails exists. Actually don't use it anywhere.

Supported Commands

Command Planned Implemented Tests
CAPABILITY
NOOP
LOGOUT
AUTHENTICATE - -
LOGIN
STARTTLS
EXAMINE
CREATE - -
DELETE - -
RENAME - -
SUBSCRIBE - -
UNSUBSCRIBE - -
LIST
LSUB
STATUS
APPEND
CHECK ?
CLOSE
EXPUNGE
SEARCH
FETCH
STORE
COPY
UID

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestConnection

func NewTestConnection(transcript io.Writer) (s *Server, clientConn *textproto.Conn, serverConn *conn.Conn, server *Server, err error)

NewTestConnection is for test facilitation. Creates a server and then dials the server, returning the connection, allowing test to inject state and wait for an expected response The connection must be started manually with `go conn.Start()` once desired state has been injected

Types

type Server

type Server struct {
	Addr string

	Transcript io.Writer
	// contains filtered or unexported fields
}

Server represents an IMAP server instance

func NewServer

func NewServer(store mailstore.Mailstore) *Server

NewServer initialises a new Server. Note that this does not start the server. You must called either Listen() followed by Serve() or call ListenAndServe()

func (*Server) Close

func (s *Server) Close() (err error)

Close stops the server listening for all new connections

func (*Server) Listen

func (s *Server) Listen() error

Listen has the server begin listening for new connections. This function is non-blocking.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() (err error)

ListenAndServe is shorthand for calling Listen() followed by Serve().

func (*Server) Serve

func (s *Server) Serve() error

Serve starts the server and spawns new goroutines to handle each client connection as they come in. This function blocks.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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