Documentation
¶
Overview ¶
Package mailtest is an in-process fake SMTP server for tests: it speaks enough ESMTP (EHLO, STARTTLS, AUTH PLAIN/LOGIN, MAIL, RCPT, DATA) for net/smtp and records every accepted message.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
From string
To []string
// Data is the raw message (headers + body, CRLF).
Data string
// User and Pass are the AUTH credentials of the session ("" without AUTH).
User, Pass string
// TLS reports whether the session was encrypted.
TLS bool
}
Message is one accepted message.
type Option ¶
type Option func(*Server)
Option configures a Server.
func WithImplicitTLS ¶
func WithImplicitTLS() Option
WithImplicitTLS serves SMTPS (TLS from the first byte).
func WithSTARTTLS ¶
func WithSTARTTLS() Option
WithSTARTTLS offers STARTTLS with a self-signed certificate.
type Server ¶
type Server struct {
// Addr is host:port of the listener.
Addr string
// Host and Port split Addr.
Host string
Port int
// contains filtered or unexported fields
}
Server is a fake SMTP server.
func (*Server) Config ¶
func (s *Server) Config() config.SMTPConfig
Config returns an SMTP configuration pointing at the server.
func (*Server) RejectRecipients ¶
RejectRecipients makes RCPT TO fail with 550.
Click to show internal directories.
Click to hide internal directories.