mail

package
v0.0.0-...-8444db5 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeHTML = "text/html"
	ContentTypeText = "text/plain"
)

Variables

View Source
var ErrUnexpectedEmailAddressFormat = errors.New("unexpected email address format")

Functions

func WithAddressHeader

func WithAddressHeader(field, address, name string) func(*SendOption)

func WithAlternativeBody

func WithAlternativeBody(contentType string, content string, setting gomail.PartSetting) func(*SendOption)

func WithBody

func WithBody(contentType string, content string, setting gomail.PartSetting) func(*SendOption)

func WithCharset

func WithCharset(charset string) func(*SendOption)

func WithCopies

func WithCopies(addresses ...string) func(*SendOption)

func WithHeader

func WithHeader(field string, values ...string) func(*SendOption)

func WithInvisibleCopies

func WithInvisibleCopies(addresses ...string) func(*SendOption)

func WithRecipients

func WithRecipients(addresses ...string) func(*SendOption)

func WithSender

func WithSender(address string, name string) func(*SendOption)

func WithSubject

func WithSubject(subject string) func(*SendOption)

Types

type AddressHeader

type AddressHeader struct {
	Field   string
	Address string
	Name    string
}

type Body

type Body struct {
	Type        string
	Content     string
	PartSetting gomail.PartSetting
}
type Header struct {
	Field  string
	Values []string
}

type Mailer

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

func NewMailer

func NewMailer(funcs ...OptionFunc) *Mailer

func (*Mailer) Send

func (m *Mailer) Send(funcs ...SendFunc) error

type Option

type Option struct {
	Host               string
	Port               int
	User               string
	Password           string
	InsecureSkipVerify bool
	UseStartTLS        bool
}

type OptionFunc

type OptionFunc func(*Option)

func WithCredentials

func WithCredentials(user, password string) OptionFunc

func WithServer

func WithServer(host string, port int) OptionFunc

func WithTLS

func WithTLS(useStartTLS, insecureSkipVerify bool) OptionFunc

type SendFunc

type SendFunc func(*SendOption)

type SendOption

type SendOption struct {
	Charset           string
	AddressHeaders    []AddressHeader
	Headers           []Header
	Body              Body
	AlternativeBodies []Body
}

Jump to

Keyboard shortcuts

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