email

package
v0.0.0-...-4be01c1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const SettingsKey = "messenger_email"

Variables

View Source
var ErrInvalidEmail = errors.New(`Invalid mail value`)
View Source
var ErrParsingAuthMethod = errors.New(`Invalid auth method`)
View Source
var ErrParsingSecurityType = errors.New(`Invalid security type`)

Functions

func SetSettings

func SetSettings(ctx context.Context, writer *metadata.AsyncWriter, settings Settings) error

func StartFakeServer

func StartFakeServer(backend smtp.Backend, addr string) func() error

func ValidateSettings

func ValidateSettings(settings Settings) (err error)

Types

type AuthMethod

type AuthMethod int
const (
	AuthMethodNone     AuthMethod = 0
	AuthMethodPassword AuthMethod = 1
)

func ParseAuthMethod

func ParseAuthMethod(s string) (AuthMethod, error)

func (*AuthMethod) MarshalJSON

func (m *AuthMethod) MarshalJSON() ([]byte, error)

func (*AuthMethod) MergoFromString

func (m *AuthMethod) MergoFromString(s string) error

func (AuthMethod) String

func (m AuthMethod) String() string

type FakeMailBackend

type FakeMailBackend struct {
	ExpectedUser     string
	ExpectedPassword string
	Messages         []*mail.Message
}

func (*FakeMailBackend) NewSession

func (b *FakeMailBackend) NewSession(c *smtp.Conn) (smtp.Session, error)

type Notifier

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

func New

func New(policy core.Policy, reader metadata.Reader) *Notifier

FIXME: this function is copied from notification/slack!!!

func NewWithCustomSettingsFetcher

func NewWithCustomSettingsFetcher(policy core.Policy, settingsFetcher SettingsFetcher) *Notifier

func (*Notifier) Notify

func (m *Notifier) Notify(n core.Notification, translator translator.Translator) error

implement Notifier TODO: split this function into smaller chunks!!!

func (*Notifier) ValidateSettings

func (*Notifier) ValidateSettings(s core.Settings) error

type SecurityType

type SecurityType int
const (
	SecurityTypeNone     SecurityType = 0
	SecurityTypeSTARTTLS SecurityType = 1
	SecurityTypeTLS      SecurityType = 2
)

func ParseSecurityType

func ParseSecurityType(s string) (SecurityType, error)

func (*SecurityType) MarshalJSON

func (t *SecurityType) MarshalJSON() ([]byte, error)

func (*SecurityType) MergoFromString

func (t *SecurityType) MergoFromString(s string) error

func (SecurityType) String

func (t SecurityType) String() string

type ServerPort

type ServerPort int

func (*ServerPort) MergoFromString

func (p *ServerPort) MergoFromString(s string) error

type Settings

type Settings struct {
	Enabled bool `json:"enabled"`

	SkipCertCheck bool `json:"skip_cert_check"`

	Sender     string `json:"sender"`
	Recipients string `json:"recipients"`

	ServerName string     `json:"server_name"`
	ServerPort ServerPort `json:"server_port"`

	SecurityType SecurityType `json:"security_type"`
	AuthMethod   AuthMethod   `json:"auth_method"`

	Username stringutil.Sensitive `json:"username,omitempty"`
	Password stringutil.Sensitive `json:"password,omitempty"`
}

func GetSettings

func GetSettings(ctx context.Context, reader metadata.Reader) (*Settings, error)

type SettingsFetcher

type SettingsFetcher func() (*Settings, *globalsettings.Settings, error)

Jump to

Keyboard shortcuts

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