smtp

package
v0.0.0-...-90b322d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialer

type Dialer struct {
	// Host represents the host of the SMTP server.
	Host string
	// Port represents the port of the SMTP server.
	Port int
	// Username is the username to use to authenticate to the SMTP server.
	Username string
	// Password is the password to use to authenticate to the SMTP server.
	Password string
	// Auth represents the authentication mechanism used to authenticate to the
	// SMTP server.
	Auth smtp.Auth
	// SSL defines whether an SSL connection is used. It should be false in
	// most cases since the authentication mechanism should use the STARTTLS
	// extension instead.
	SSL bool
	// TSLConfig represents the TLS configuration used for the TLS (when the
	// STARTTLS extension is used) or SSL connection.
	TLSConfig *tls.Config
	// LocalName is the hostname sent to the SMTP server with the HELO command.
	// By default, "localhost" is sent.
	LocalName string
}

A Dialer is a dialer to an SMTP server.

func NewDialer

func NewDialer(host string, port int, username, password string) *Dialer

NewDialer returns a new SMTP Dialer. The given parameters are used to connect to the SMTP server.

func NewPlainDialer deprecated

func NewPlainDialer(host string, port int, username, password string) *Dialer

NewPlainDialer returns a new SMTP Dialer. The given parameters are used to connect to the SMTP server.

Deprecated: Use NewDialer instead.

func (*Dialer) Dial

func (d *Dialer) Dial() (send.SendCloser, error)

Dial dials and authenticates to an SMTP server. The returned SendCloser should be closed when done using it.

func (*Dialer) DialAndSend

func (d *Dialer) DialAndSend(m ...*msg.Message) error

DialAndSend opens a connection to the SMTP server, sends the given emails and closes the connection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL