Documentation ¶
Index ¶
- Variables
- func CanonicalizeEmail(local string) string
- func LimitDataSize(r io.Reader, s int64) io.Reader
- func ListenAndServe(addr string, handler Handler) error
- func ListenAndServeTLS(addr, certFile, keyFile string, handler Handler) error
- func SplitAddress(address string) (string, string, error)
- type Handler
- type Processor
- type Request
- type Server
Constants ¶
This section is empty.
Variables ¶
var ( // ErrorRequestedActionAbortedLocalError .. ErrorRequestedActionAbortedLocalError = errors.New("Requested action aborted: local error in processing") // ErrorTransactionFailed .. ErrorTransactionFailed = errors.New("Transaction failed") // ErrorServiceNotAvailable .. ErrorServiceNotAvailable = errors.New("Service not available, closing transmission channel") // ErrorRequestedActionAbortedExceededStorage .. ErrorRequestedActionAbortedExceededStorage = errors.New("Requested mail action aborted: exceeded storage allocation") )
var ( // DefaultProcessors holds processor functions DefaultProcessors = map[string]Processor{ "EHLO": ehloProcessor, "HELO": ehloProcessor, "STARTTLS": starttlsProcessor, "AUTH": authProcessor, "MAIL": mailProcessor, "RCPT": rcptProcessor, "DATA": dataProcessor, "RSET": rsetProcessor, "VRFY": vrfyProcessor, "EXPN": expnProcessor, "HELP": helpProcessor, "NOOP": noopProcessor, "QUIT": quitProcessor, } )
Functions ¶
func CanonicalizeEmail ¶
CanonicalizeEmail format the specified email address I'm following googles example here. Basically all '.' dont matter in the local portion. Also you can append a '+' section to the end of your email and it will still route to you. This allows categorization of emails when they are given out. The muxer will canonicalize incoming email addresses to route them to a handler. The handler will still see the original email in the to portion.
func LimitDataSize ¶
LimitDataSize Limit the incoming data size of the DATA command
func ListenAndServe ¶
ListenAndServe start listening on the specified addr using the specified handler
func ListenAndServeTLS ¶
ListenAndServeTLS start listening on the specified addr using the specified handler and tls configs
Types ¶
type Request ¶
type Request struct { // the currently running server Server *Server // the underlying socket for currently connected client Conn net.Conn // an instance of go stdlib for handling the above Conn as a text-porotocol TextProto *textproto.Conn // TLS related info TLSState *tls.ConnectionState // a shortcut for Conn.RemoteAddr() RemoteAddr string // contains the hostname of the currently connected client during the EHLO/HELO command HelloHost string // whether EHLO/HELO called or not HelloRecieved bool // the login username used for login, empty means that this is an anonymous attempt AuthUser string // the user that sends the mail From string // the rctps! To []string // the body of the mail "DATA command" but parsed Message *mail.Message // whether the client called QUIT or not QuitSent bool // whether to check the from domain DisableFromChecks bool // the spf checking result SPFResult spf.Result // whether the FROM mail is mailable or not Mailable bool // the currently processing line Line []string }
Request is the incoming connection meta-data
func NewRequest ¶
NewRequest creates a new instance of the Request struct
type Server ¶
type Server struct { // The name of the server used while greeting Name string // The address to listen on Addr string // The default inbox handler Handler Handler // If a tls config is set then this server will broadcast support // for the STARTTLS (RFC3207) extension. TLSConfig *tls.Config // Auth specifies an optional callback function that is called // when a client attempts to authenticate. If left nil (the default) // then the AUTH extension will not be supported. Auth func(username, password, remoteAddress string) error // Addressable specifies an optional callback function that is called // when a client attempts to send a message to the given address. This // allows the server to refuse messages that it doesn't own. If left nil // (the default) then the server will assume true Addressable func(user, address string) bool // Processors is a map of current supported commands' processor for incomming // SMTP messages/lines. Processors map[string]Processor // Maximum size of the DATA command in bytes MaxBodySize int64 DisableFromChecks bool }
Server is our main server handler
func (*Server) ListenAndServe ¶
ListenAndServe start serving the incoming data
func (*Server) ListenAndServeTLS ¶
ListenAndServeTLS start serving the incoming tls connection