email

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMailerNotConfigured = errors.New("Mailer not configured")
	ErrEmailCreationFailed = errors.New("Email creation failed")
	ErrEmailSendingFailed  = errors.New("Email sending failed")
)

Functions

func Compose

func Compose(ctx context.Context,
	out io.Writer, tpl *template.Template,
	from, to *mail.Address, subject string, f ...func(*templates.Context)) error

func Register added in v0.0.11

func Register(ctx context.Context, vm *goja.Runtime)

func Send added in v0.0.11

func Send(ctx context.Context) func(e *Email) (int, error)

func SendActivation

func SendActivation(ctx context.Context, code uint64) error

func SendInviteToExistingUser added in v0.0.11

func SendInviteToExistingUser(ctx context.Context, by *models.User, site *models.Site, to string) error

func SendInviteToNewUser added in v0.0.11

func SendInviteToNewUser(ctx context.Context, by *models.User, site *models.Site, i *models.Invitation) error

func SendPasswordReset added in v0.0.11

func SendPasswordReset(ctx context.Context, usr *models.User, link string) error

func Set

func Set(ctx context.Context, m Mailer) context.Context

Types

type Address added in v0.0.11

type Address struct {
	Name    string `json:"name"`
	Address string `json:"address"`
}

type Email added in v0.0.11

type Email struct {
	To          *Address `json:"to"`
	Subject     string   `json:"subject"`
	ContentType string   `json:"contentType"`
	Message     string   `json:"msg"`
}

type MailHog

type MailHog struct {
	*SMTP
}

func (*MailHog) SendMail

func (m *MailHog) SendMail(from string, to []string, msg io.Reader) error

type Mailer

type Mailer interface {
	SendMail(from string, to []string, msg io.Reader) error
	From() *mail.Address
	io.Closer
}

func FromConfig

func FromConfig(o *config.Options) (Mailer, error)

func Get

func Get(ctx context.Context) Mailer

type SMTP

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

func (*SMTP) Close

func (s *SMTP) Close() error

func (*SMTP) From

func (s *SMTP) From() *mail.Address

func (*SMTP) SendMail

func (s *SMTP) SendMail(from string, to []string, msg io.Reader) error

Jump to

Keyboard shortcuts

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