smtp

package
v1.21.4 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const (
	PlainAuthentication   = "PLAIN"
	LoginAuthentication   = "LOGIN"
	CRAMMD5Authentication = "CRAM-MD5"
)

SMTP authentication type names.

Variables

Authenticators contains available SMTP authentication type names.

View Source
var ErrUnsupportedLoginType = errors.New("Login source is unknown")

ErrUnsupportedLoginType login source is unknown error

Functions

func Authenticate

func Authenticate(a smtp.Auth, source *Source) error

Authenticate performs an SMTP authentication.

Types

type Source

type Source struct {
	Auth           string
	Host           string
	Port           int
	AllowedDomains string `xorm:"TEXT"`
	ForceSMTPS     bool
	SkipVerify     bool
	HeloHostname   string
	DisableHelo    bool
	SkipLocalTwoFA bool `json:",omitempty"`
	// contains filtered or unexported fields
}

Source holds configuration for the SMTP login source.

func (*Source) Authenticate

func (source *Source) Authenticate(ctx context.Context, user *user_model.User, userName, password string) (*user_model.User, error)

Authenticate queries if the provided login/password is authenticates against the SMTP server Users will be autoregistered as required

func (*Source) FromDB

func (source *Source) FromDB(bs []byte) error

FromDB fills up an SMTPConfig from serialized format.

func (*Source) HasTLS

func (source *Source) HasTLS() bool

HasTLS returns true for SMTP

func (*Source) IsSkipLocalTwoFA

func (source *Source) IsSkipLocalTwoFA() bool

IsSkipLocalTwoFA returns if this source should skip local 2fa for password authentication

func (*Source) IsSkipVerify

func (source *Source) IsSkipVerify() bool

IsSkipVerify returns if SkipVerify is set

func (*Source) SetAuthSource

func (source *Source) SetAuthSource(authSource *auth.Source)

SetAuthSource sets the related AuthSource

func (*Source) ToDB

func (source *Source) ToDB() ([]byte, error)

ToDB exports an SMTPConfig to a serialized format.

func (*Source) UseTLS

func (source *Source) UseTLS() bool

UseTLS returns if TLS is set

Jump to

Keyboard shortcuts

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