mailz

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSESConfigSingletonInjector

func NewSESConfigSingletonInjector(cfg *SESConfig) injectz.Injector

NewSESConfigSingletonInjector always inject the given SESConfig.

func NewSMTPConfigSingletonInjector

func NewSMTPConfigSingletonInjector(cfg *SMTPConfig) injectz.Injector

NewSMTPConfigSingletonInjector always inject the given SMTPConfig.

func NewSingletonInjector

func NewSingletonInjector(m Mail) injectz.Injector

NewSingletonInjector always injects the given Mail.

func SESInitializer

func SESInitializer(ctx context.Context) (injectz.Injector, injectz.Releaser)

SESInitializer is a Mail initializer which provides a default implementation using the AWS SESv2 API.

func SMTPInitializer

func SMTPInitializer(ctx context.Context) (injectz.Injector, injectz.Releaser)

SMTPInitializer is a Mail initializer which provides a default implementation using SMTP.

Types

type ContextMail

type ContextMail interface {
	Send(message *Message) error
}

ContextMail describes a Mail with a cached context.

func Get

func Get(ctx context.Context) ContextMail

Get extracts the Mail from context and wraps it as ContextMail, panics if not found.

type Mail

type Mail interface {
	Send(ctx context.Context, message *Message) error
}

Mail describes the mail module.

type Message

type Message struct {
	From     string   `json:"from"`
	ReplyTo  string   `json:"replyTo"`
	To       []string `json:"to"`
	CC       []string `json:"cc"`
	Subject  string   `json:"subject"`
	TextBody string   `json:"textBody"`
	HTMLBody string   `json:"htmlBody"`
}

Message describes a message.

type SESConfig

type SESConfig struct {
	AWSConfig *aws.Config `json:"-" validate:"required"`
}

SESConfig describes the configuration for the SES Mail implementation.

func (*SESConfig) Validate added in v1.1.0

func (c *SESConfig) Validate() error

Validate implements the vz.Validator interface.

type SESSender

type SESSender interface {
	SendEmail(ctx context.Context, params *awssesv2.SendEmailInput, optFns ...func(*awssesv2.Options)) (*awssesv2.SendEmailOutput, error)
}

SESSender describes the ability to send mail over the AWS SESv2 API.

type SMTPConfig

type SMTPConfig struct {
	URL                   string `json:"url" validate:"required,url"`
	ConnectTimeoutSeconds uint32 `json:"connectTimeoutSeconds" validate:"required"`
}

SMTPConfig describes the configuration for the SMTP Mail implementation.

func (*SMTPConfig) ParseURL

func (c *SMTPConfig) ParseURL() (string, string, string, uint16, error)

ParseURL parses the URL.

func (*SMTPConfig) Validate added in v1.1.0

func (c *SMTPConfig) Validate() error

Validate implements the vz.Validator interface.

type SMTPSender

type SMTPSender interface {
	DialAndSend(m ...*mail.Message) error
}

SMTPSender describes the ability to send mail over SMTP.

Directories

Path Synopsis
mockmailz
Package mockmailz is a generated GoMock package.
Package mockmailz is a generated GoMock package.

Jump to

Keyboard shortcuts

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