Help us shape the future of Go! Take the 2026 Go Developer Survey

smtp

package
v3.1.61 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT, MIT Imports: 15 Imported by: 0

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.ConfigBase `json:"-"`

	Auth           string
	Host           string
	Port           int
	AllowedDomains string `xorm:"TEXT"`
	ForceSMTPS     bool
	SkipVerify     bool
	HeloHostname   string
	DisableHelo    bool
}

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) IsSkipVerify

func (source *Source) IsSkipVerify() bool

IsSkipVerify returns if SkipVerify is set

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

Source Files

  • auth.go
  • source.go
  • source_authenticate.go

Jump to

Keyboard shortcuts

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