Documentation ¶
Index ¶
- Variables
- type AuthenticationMethod
- type Direction
- type Message
- type RawLine
- type Result
- type Security
- type SmtpServer
- func (s *SmtpServer) GetConnectionAddresses() ([]string, error)
- func (s *SmtpServer) GetResultMessage(connectionAddress string, connectionSequenceNo int, messageSequenceNo int) (*Message, error)
- func (s *SmtpServer) GetResultRawText(connectionAddress string, connectionSequenceNo int) ([]RawLine, error)
- func (s *SmtpServer) ListenAndServe() error
- func (s *SmtpServer) Shutdown() error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AuthenticationMethod ¶
type AuthenticationMethod string
const ( NoAuthentication AuthenticationMethod = "" PlainAuth AuthenticationMethod = "plain" CramMd5Auth AuthenticationMethod = "cram-md5" )
type SmtpServer ¶
type SmtpServer struct {
// contains filtered or unexported fields
}
func NewSmtpServer ¶
func NewSmtpServer(sec Security, servername, addr, certFile, keyFile string) (*SmtpServer, error)
NewSmtpServer creates a new instance of SmtpServer. Parameters are the type of security (e.g. No security, SSL-TLS, STARTTLS), a servername, the server address (mail.example.com:587), path to PEM encoded public key and path to PEM encoded privat key. Leave the paths empty if no security is applied. An error is returned for an unknown security type or invalid keys
func (*SmtpServer) GetConnectionAddresses ¶
func (s *SmtpServer) GetConnectionAddresses() ([]string, error)
GetConnectionAddresses returns all connection addresses that made a connection to the SMTP server.
func (*SmtpServer) GetResultMessage ¶
func (s *SmtpServer) GetResultMessage(connectionAddress string, connectionSequenceNo int, messageSequenceNo int) (*Message, error)
GetResultMessage returns the mail message received by the SMTP server for a given connection address, connection sequence number and message sequence number. The connection sequence number is usually 1, but can be increased if a subsequent connection would use the same TCP port (which is very unlikely). The message sequence number starts with 1 and is increased by 1 for every new message within the same connection.
func (*SmtpServer) GetResultRawText ¶
func (s *SmtpServer) GetResultRawText(connectionAddress string, connectionSequenceNo int) ([]RawLine, error)
GetResultRawText returns the raw text received by the SMTP server for a given connection address and connection sequence number. The connection sequence number is usually 1, but can be increased if a subsequent connection would use the same TCP port (which is very unlikely).
func (*SmtpServer) ListenAndServe ¶
func (s *SmtpServer) ListenAndServe() error
ListenAndServe starts the SMTP server and begins listening for incoming connections. An error is returned if there was an issue setting up the listener.
func (*SmtpServer) Shutdown ¶
func (s *SmtpServer) Shutdown() error
Shutdown gracefully shuts down the SMTP server It returns an error if there was an issue shutting down the server.