mailer

package
v0.0.0-...-5cbc45b Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Mailer   string
	SMTP     SMTPConfig
	SendGrid SendGridConfig
	SES      SESConfig
}

type Contact

type Contact struct {
	Email string
	Name  string
}

type Mail

type Mail struct {
	To           []Contact
	Subject      string
	PlainContent string
	HTMLContent  string
}

type Mailer

type Mailer interface {
	SendMail(ctx context.Context, toContacts []Contact, subject, plainContent, htmlContent string) error
}

func New

func New(ctx context.Context, conf *Config) (m Mailer)

func NewDirect

func NewDirect(from string) Mailer

func NewLogger

func NewLogger() Mailer

func NewSES

func NewSES(ctx context.Context, senderName, senderEmail string) Mailer

func NewSMTP

func NewSMTP(host, port, username, email, password string) Mailer

func NewSendGrid

func NewSendGrid(senderName, senderEmail, api string) Mailer

type Mock

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

func NewMock

func NewMock() *Mock

func (*Mock) Mails

func (m *Mock) Mails() []Mail

func (*Mock) SendMail

func (m *Mock) SendMail(ctx context.Context, to []Contact, subject, text, html string) error

type SESConfig

type SESConfig struct {
	Email string
	Name  string
}

type SMTPConfig

type SMTPConfig struct {
	Host         string
	Port         string
	SMTPUsername string
	Email        string
	Password     string
}

type SendGridConfig

type SendGridConfig struct {
	Email string
	Name  string
	API   string
}

type ToList

type ToList []Contact

func (ToList) String

func (l ToList) String() string

Jump to

Keyboard shortcuts

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