smtp

package module
v0.0.0-...-36c1643 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: MIT Imports: 10 Imported by: 0

README

smtp-go

SMTP client library for the Go language.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCRLFContain = errors.New("smtp: A line must not contain CR or LF")

ErrCRLFContain is returned when command text containing CR or LF.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a client connection an SMTP server.

func NewClient

func NewClient(host string) *Client

NewClient returns new Client.

func (*Client) Send

func (c *Client) Send(r *Request) error

Send sends an email with the request r.

type Header map[string][]string

Header represents the key-value pairs in an SMTP header.

func (Header) Add

func (h Header) Add(key, value string)

Add adds the key, value pair to the header.

func (Header) Del

func (h Header) Del(key string)

Del deletes the values associated with key.

func (Header) Get

func (h Header) Get(key string) string

Get gets the first value associated with the given key.

func (Header) Set

func (h Header) Set(key, value string)

Set sets the header entries associated with key to the single element value.

func (Header) Write

func (h Header) Write(w io.Writer) error

Write writes a header in wire format.

func (Header) WriteSubset

func (h Header) WriteSubset(w io.Writer, exclude map[string]bool) error

WriteSubset writes a header in wire format. If exclude is not nil, keys where exclude[key] == true are not written.

type Request

type Request struct {
	From      string
	To        []string
	Cc        []string
	Bcc       []string
	Subject   string
	Header    Header
	Body      io.ReadCloser
	StartTLS  bool
	TLSConfig *tls.Config
	// contains filtered or unexported fields
}

Request represents an mail request.

func NewRequest

func NewRequest(ctx context.Context, to []string, body io.Reader) (*Request, error)

NewRequest returns new Request.

func (*Request) Write

func (r *Request) Write(w io.Writer) error

Jump to

Keyboard shortcuts

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