smtp

package
v3.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host         string        `json:"host"`
	Port         int           `json:"port"`
	AuthProtocol string        `json:"auth_protocol"`
	Username     string        `json:"username"`
	Password     string        `json:"password"`
	FromEmail    string        `json:"from_email"`
	Timeout      time.Duration `json:"timeout"`
	MaxConns     int           `json:"max_conns"`

	// STARTTLS or TLS.
	TLSType       string `json:"tls_type"`
	TLSSkipVerify bool   `json:"tls_skip_verify"`
}

Config represents an SMTP server's credentials.

type SMTP

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

SMTP is a generic SMTP e-mail provider.

func New

func New(cfg Config) (*SMTP, error)

New creates and returns an e-mail Provider backend.

func (*SMTP) AddressDesc

func (s *SMTP) AddressDesc() string

AddressDesc returns the help text that is shown to the end users when they're asked to enter their addresses (eg: e-mail or phone), if the OTP registered without an address.

func (*SMTP) AddressName

func (s *SMTP) AddressName() string

AddressName returns the e-mail Provider's address name.

func (*SMTP) ChannelDesc

func (s *SMTP) ChannelDesc() string

ChannelDesc returns help text for the e-mail verification Provider.

func (*SMTP) ChannelName

func (s *SMTP) ChannelName() string

ChannelName returns the e-mail Provider's name.

func (*SMTP) ID

func (s *SMTP) ID() string

ID returns the Provider's ID.

func (*SMTP) MaxAddressLen

func (s *SMTP) MaxAddressLen() int

MaxAddressLen returns the maximum allowed length of the e-mail address.

func (*SMTP) MaxBodyLen

func (s *SMTP) MaxBodyLen() int

MaxBodyLen returns the max permitted body size.

func (*SMTP) MaxOTPLen

func (s *SMTP) MaxOTPLen() int

MaxOTPLen returns the maximum allowed length of the OTP value.

func (*SMTP) Push

func (s *SMTP) Push(otp models.OTP, subject string, m []byte) error

Push pushes an e-mail to the SMTP server.

func (*SMTP) ValidateAddress

func (s *SMTP) ValidateAddress(to string) error

ValidateAddress "validates" an e-mail address.

Jump to

Keyboard shortcuts

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