# README
go-smtp
An ESMTP client and server library written in Go.
Features
- ESMTP client & server implementing RFC 5321
- Support for additional SMTP extensions such as AUTH and PIPELINING
- UTF-8 support for subject and message
- LMTP support
Relationship with net/smtp
The Go standard library provides a SMTP client implementation in net/smtp
.
However net/smtp
is frozen: it's not getting any new features. go-smtp
provides a server implementation and a number of client improvements.
Licence
MIT
# Functions
Dial returns a new Client connected to an SMTP server at addr.
DialStartTLS retruns a new Client connected to an SMTP server via STARTTLS at addr.
DialTLS returns a new Client connected to an SMTP server via TLS at addr.
NewClient returns a new Client using an existing connection and host as a server name to be used when authenticating.
NewClientLMTP returns a new LMTP Client (as defined in RFC 2033) using an existing connection and host as a server name to be used when authenticating.
NewClientStartTLS creates a new Client and performs a STARTTLS command.
New creates a new SMTP server.
SendMail connects to the server at addr, switches to TLS, authenticates with the optional SASL client, and then sends an email from address from, to addresses to, with message r.
SendMailTLS works like SendMail, but with implicit TLS.
# Variables
EnhancedCodeNotSet is a nil value of EnhancedCode field in SMTPError, used to indicate that backend failed to provide enhanced status code.
ErrDataReset is returned by Reader pased to Data function if client does not send another BDAT command and instead closes connection or issues RSET command.
NoEnhancedCode is used to indicate that enhanced error code should not be included in response.
# Structs
A Client represents a client connection to an SMTP server.
MailOptions contains parameters for the MAIL command.
RcptOptions contains parameters for the RCPT command.
A SMTP server.
SMTPError specifies the error code, enhanced error code (if any) and message returned by the server.
# Interfaces
AuthSession is an add-on interface for Session.
A SMTP server backend.
LMTPSession is an add-on interface for Session.
Logger interface is used by Server to report unexpected internal errors.
Session is used by servers to respond to an SMTP client.
StatusCollector allows a backend to provide per-recipient status information.
# Type aliases
BackendFunc is an adapter to allow the use of an ordinary function as a Backend.