mailer

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorParamEmpty liberr.CodeError = iota + liberr.MinPkgMailer
	ErrorMailerConfigInvalid
	ErrorMailerHtml
	ErrorMailerText
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.8.1

type Config struct {
	Theme            string      `json:"theme,omitempty" yaml:"theme,omitempty" toml:"theme,omitempty" mapstructure:"theme,omitempty" validate:"required"`
	Direction        string      `` /* 135-byte string literal not displayed */
	Name             string      `json:"name,omitempty" yaml:"name,omitempty" toml:"name,omitempty" mapstructure:"name,omitempty" validate:"required"`
	Link             string      `json:"link,omitempty" yaml:"link,omitempty" toml:"link,omitempty" mapstructure:"link,omitempty" validate:"required,url"`
	Copyright        string      `` /* 135-byte string literal not displayed */
	TroubleText      string      `` /* 143-byte string literal not displayed */
	DisableCSSInline bool        `` /* 143-byte string literal not displayed */
	Body             libhms.Body `json:"body" yaml:"body" toml:"body" mapstructure:"body" validate:"required"`
}

func (Config) NewMailer added in v1.8.1

func (c Config) NewMailer() Mailer

func (Config) Validate added in v1.8.1

func (c Config) Validate() liberr.Error

type Mailer

type Mailer interface {
	Clone() Mailer

	SetTheme(t Themes)
	GetTheme() Themes

	SetTextDirection(d TextDirection)
	GetTextDirection() TextDirection

	SetBody(b *hermes.Body)
	GetBody() *hermes.Body

	SetCSSInline(disable bool)

	SetName(name string)
	GetName() string

	SetCopyright(copy string)
	GetCopyright() string

	SetLink(link string)
	GetLink() string


	SetTroubleText(text string)
	GetTroubleText() string

	ParseData(data map[string]string)

	GenerateHTML() (*bytes.Buffer, liberr.Error)
	GeneratePlainText() (*bytes.Buffer, liberr.Error)
}

func New

func New() Mailer

type TextDirection

type TextDirection uint8
const (
	LeftToRight TextDirection = iota
	RightToLeft
)

func ParseTextDirection

func ParseTextDirection(direction string) TextDirection

func (TextDirection) String

func (d TextDirection) String() string

type Themes

type Themes uint8
const (
	ThemeDefault Themes = iota
	ThemeFlat
)

func ParseTheme

func ParseTheme(theme string) Themes

func (Themes) String

func (t Themes) String() string

Jump to

Keyboard shortcuts

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