mailer

package
v0.0.0-...-7de2586 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

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

Content Type

Variables

View Source
var (
	ErrNoMessage   = fmt.Errorf("Mailer: No message to be sent")
	ErrNoRecipient = fmt.Errorf("Mailer: No email recipient")
)

Mailer error

Functions

This section is empty.

Types

type GomailAdapter

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

GomailAdapter is a concrete struct of gomail adapter.

func (*GomailAdapter) Send

func (g *GomailAdapter) Send(ctx context.Context, messages ...Message) (err error)

Send will send the email.

type GomailDialer

type GomailDialer interface {
	DialAndSend(m ...*gomail.Message) error
}

GomailDialer is an abstraction of gomail.Dialer.

type Mailer

type Mailer interface {
	Send(ctx context.Context, messages ...Message) (err error)
}

Mailer is collection of behavior of mailer.

func NewGomailAdapter

func NewGomailAdapter(logger *logrus.Logger, defaultSender string, dialer GomailDialer, active bool) Mailer

NewGomailAdapter is a constructor.

type Message

type Message struct {
	From        string
	To          []Recepient
	CC          []Recepient
	Subject     string
	MessageBody MessageBody
}

Message is a message to be sent to the mail server.

type MessageBody

type MessageBody struct {
	ContentType string
	Body        []byte
}

MessageBody is the message body and the content type.

type Recepient

type Recepient struct {
	Address string
	Name    string
}

Recepient is data type for the mail recipient.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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