mailer

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockDialer

func NewMockDialer() *mocks.Dialer

Types

type Config

type Config struct {
	SMTPHost     string            `yaml:"smtp_host" mapstructure:"smtp_host"`
	SMTPPort     int               `yaml:"smtp_port" mapstructure:"smtp_port"`
	SMTPUsername string            `yaml:"smtp_username" mapstructure:"smtp_username"`
	SMTPPassword string            `yaml:"smtp_password" mapstructure:"smtp_password"`
	SMTPInsecure bool              `yaml:"smtp_insecure" mapstructure:"smtp_insecure" default:"true"`
	Headers      map[string]string `yaml:"headers" mapstructure:"headers"`

	// SMTP TLS policy to use when establishing a connection.
	// Defaults to MandatoryStartTLS.
	// Possible values are:
	// opportunistic: Use STARTTLS if the server supports it, otherwise connect without encryption.
	// mandatory: Always use STARTTLS.
	// none: Never use STARTTLS.
	SMTPTLSPolicy string `yaml:"smtp_tls_policy" mapstructure:"smtp_tls_policy" default:"mandatory"`
}

func (Config) TLSPolicy added in v0.8.11

func (c Config) TLSPolicy() mail.StartTLSPolicy

type Dialer

type Dialer interface {
	DialAndSend(m *mail.Message) error
	FromHeader() string
}

type DialerImpl

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

func NewDialerImpl

func NewDialerImpl(SMTPHost string, SMTPPort int, SMTPUser string, SMTPPass string,
	SMTPInsecure bool, headers map[string]string, tlsPolicy mail.StartTLSPolicy) *DialerImpl

func (DialerImpl) DialAndSend

func (m DialerImpl) DialAndSend(msg *mail.Message) error

func (DialerImpl) FromHeader

func (m DialerImpl) FromHeader() string

FromHeader returns the headers to be added to the mail as from field

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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