Documentation
¶
Overview ¶
Package mail provides a simple SMTP client for sending plain-text emails.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func NewClient ¶
func NewClient(cfg ClientConfig) (*Client, error)
NewClient will use the given ClientConfig to return an *smtp.Client. Depending on the fields present in the given config will determine whether authentication or TLS connectivity is made.
type ClientConfig ¶
type ClientConfig struct {
// CA is the path to the PEM encoded root CAs. If empty then TLS will not
// be attempted upon connection to the SMTP server.
CA string
// Addr is the full address (host and port) of the SMTP server to connect
// to.
Addr string
// Username and Password are the credentials to use the plain
// authentication against the SMTP server. If none are provided then no
// authentication attempts are made.
Username string
Password string
}
ClientConfig specifies how the client connection to the SMTP server should be configured.
type ErrRcpts ¶
ErrRcpts is a list of any errors that occur when a RCPT command is send to the SMTP server. This will store each error message against the corresponding recipient that caused the error.
type Mail ¶
type Mail struct {
From string // From is the address we're sending the mail from.
To []string // To is the list of addresses to send the mail to.
Subject string // Subject is the subject line of the mail.
Body string // Body is the body of the mail.
}
Click to show internal directories.
Click to hide internal directories.