Documentation ¶
Index ¶
- Constants
- Variables
- func GetTLSConfig(c *TLSConfig) (*tls.Config, error)
- func LimitedRead(r io.Reader, size int64) ([]byte, error)
- func NewBackend(ss smtp.Backend, tc *tls.Config, port, maxSize int, hostname string) *smtp.Server
- type Config
- type EmailSender
- type SMTPService
- func (ss *SMTPService) AnonymousLogin(state *smtp.ConnectionState) (smtp.Session, error)
- func (ss *SMTPService) Login(state *smtp.ConnectionState, username, password string) (smtp.Session, error)
- func (ss *SMTPService) Name() string
- func (ss *SMTPService) Start() error
- func (ss *SMTPService) Stop() error
- type Session
- type TLSConfig
Constants ¶
View Source
const ( SecurityPass string = "pass" SecurityFail string = "fail" )
Variables ¶
View Source
var ( ErrHashFail = errors.New("error while hashing password") ErrInvalidDestination = errors.New("invalid destination") ErrParsingError = errors.New("parsing error") ErrDomainMisalignment = errors.New("domains not aligned") ErrMaxSizeExceeded = errors.New("maximum message size exceeded") ErrValidationError = errors.New("validation failed") ErrMissingDependency = errors.New("missing dependency") )
View Source
var ( ErrSMTPInvalidDestination = &smtp.SMTPError{ Code: 552, EnhancedCode: smtp.EnhancedCode{5, 3, 4}, Message: "Invalid destination", } ErrSMTPServerError = &smtp.SMTPError{ Code: 552, EnhancedCode: smtp.EnhancedCode{5, 3, 4}, Message: "Server error", } )
TODO research valid SMTP codes.
Functions ¶
func LimitedRead ¶
LimitedRead validates a mail message is no more than 'size' bytes, and returns a new io.Reader containing a copy of the original bytes.
Types ¶
type Config ¶ added in v0.1.2
type EmailSender ¶ added in v0.1.12
type EmailSender interface {
SendMail(*letterbox.ForwardingMessage) error
}
type SMTPService ¶
type SMTPService struct {
// contains filtered or unexported fields
}
func New ¶ added in v0.1.12
func New( cfg Config, db letterbox.Datastore, log logger.Logger, bannerBuilder *banner.Builder, dkim dkimChecker, spf spfChecker, client EmailSender, mailboxes *letterbox.MailboxService, messages *letterbox.MessageService, stats *letterbox.MailboxStatsService, ) *SMTPService
func (*SMTPService) AnonymousLogin ¶ added in v0.1.2
func (ss *SMTPService) AnonymousLogin(state *smtp.ConnectionState) (smtp.Session, error)
AnonymousLogin requires clients to authenticate using SMTP AUTH before sending emails.
func (*SMTPService) Login ¶ added in v0.1.2
func (ss *SMTPService) Login(state *smtp.ConnectionState, username, password string) (smtp.Session, error)
Login handles a login command with username and password.
func (*SMTPService) Name ¶
func (ss *SMTPService) Name() string
func (*SMTPService) Start ¶
func (ss *SMTPService) Start() error
func (*SMTPService) Stop ¶
func (ss *SMTPService) Stop() error
type Session ¶ added in v0.1.2
type Session struct { SMTPClient EmailSender DB letterbox.Datastore DKIM dkimChecker SPF spfChecker Log logger.Logger Banner *banner.Builder MaxSize int64 Mailboxes *letterbox.MailboxService Messages *letterbox.MessageService Stats *letterbox.MailboxStatsService RemoteAddr net.Addr Helo string From string To string Mailbox *letterbox.Mailbox }
type TLSConfig ¶ added in v0.1.2
type TLSConfig struct { // The certificate string Cert string `json:"cert,omitempty"` // The (unencrypted) private key string Key string `json:"key,omitempty"` // The path to the file containing the certificate CertFile string `json:"cert_file,omitempty"` // The path to the file containing the (unencrypted) private key KeyFile string `json:"key_file,omitempty"` // The port to use for the TLS-only SMTPS server // This server is wrapped with TLS, and doesn't use the STARTTLS function // See RFC8314 Port int `json:"port,omitempty"` }
Directories ¶
Path | Synopsis |
---|---|
Vendored code from https://github.com/ArkaGPL/parsemail This code addresses some fixes missing from github.com/DusanKasan/parsemail.
|
Vendored code from https://github.com/ArkaGPL/parsemail This code addresses some fixes missing from github.com/DusanKasan/parsemail. |
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
Click to show internal directories.
Click to hide internal directories.