email

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BodyContentTypePlain string = "text/plain"
	BodyContentTypeHTML  string = "text/html"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSSESConfig

type AWSSESConfig struct {
	Region          string
	AccessKeyID     string
	SecretAccessKey string
}

type BodyFromHTMLParams

type BodyFromHTMLParams struct {
	Filename          string
	OverrideDirectory string
	Data              any
	FuncMap           map[string]any
}

type BodyFromMJMLParams

type BodyFromMJMLParams struct {
	Filename          string
	OverrideDirectory string
	Data              any
	FuncMap           map[string]any
}

type Config

type Config struct {
	SMTP     SMTPConfig
	Template TemplateConfig
}

type Interface

type Interface interface {
	SendEmail(ctx context.Context, params SendEmailParams) error
	GenerateBody() TemplateInterface
}

func Init

func Init(cfg Config, log logger.Interface) Interface

type Recipient

type Recipient struct {
	ToEmails  []string
	CCEmails  []string
	BCCEmails []string
}

type SMTPConfig

type SMTPConfig struct {
	Host      string
	Port      int
	Username  string
	Password  string
	TLSConfig struct {
		InsecureSkipVerify bool
	}
}

type SendEmailParams

type SendEmailParams struct {
	Body        string
	BodyType    string
	Subject     string
	SenderName  string
	SenderEmail string
	Recipients  Recipient
	Attachments []string
	Headers     map[string]string
}

type TemplateConfig

type TemplateConfig struct {
	FileDirectory string
}

type TemplateInterface

type TemplateInterface interface {
	FromHTML(params BodyFromHTMLParams) (string, error)
	FromMJML(ctx context.Context, params BodyFromMJMLParams) (string, error)
}

Jump to

Keyboard shortcuts

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