smtpgw

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Vault          *vault.Vault
	GatewayAccount string
}

Backend will hold the Vault to use and the GatewayAccount if needed

func New

func New(v *vault.Vault, ga string) *Backend

New will create a new backend

func (*Backend) AnonymousLogin

func (be *Backend) AnonymousLogin(state *smtp.ConnectionState) (smtp.Session, error)

AnonymousLogin will accept mails if this server allows to be a email<->bitmaelum gateway

func (*Backend) Login

func (be *Backend) Login(state *smtp.ConnectionState, username, password string) (smtp.Session, error)

Login handles a login command with username and password. We accept any password as long the username is a valid account on the vault

type Session

type Session struct {
	Account    string
	Vault      *vault.Vault
	Info       *vault.AccountInfo
	Client     *api.API
	From       string
	IsGateway  bool
	To         string
	RemoteAddr net.Addr
}

A Session is returned after successful login.

func (*Session) Data

func (s *Session) Data(r io.Reader) error

Data is called when doing a "DATA"

func (*Session) Logout

func (s *Session) Logout() error

Logout is called when logging out

func (*Session) Mail

func (s *Session) Mail(from string, opts smtp.MailOptions) error

Mail is called when doing a "MAIL FROM:"

func (*Session) Rcpt

func (s *Session) Rcpt(to string) error

Rcpt is called when doing a "RCPT TO:"

func (*Session) Reset

func (s *Session) Reset()

Reset is called when resetting the session

Jump to

Keyboard shortcuts

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