pmail

package
v0.0.0-...-1809e84 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultHandler

func DefaultHandler(_ context.Context, c *client.Client, update client.Update) error

Types

type Addr

type Addr struct {
	Server string
	Port   uint
}

func (*Addr) Url

func (addr *Addr) Url() string

type Client

type Client struct {
	*client.Client
	// contains filtered or unexported fields
}

func NewIMAPClient

func NewIMAPClient() (*Client, error)

func (*Client) ListenForUpdates

func (c *Client) ListenForUpdates(stop <-chan struct{}) error

func (*Client) Use

func (c *Client) Use(handler UpdateHandlerClosure)

type Config

type Config struct {
	Email    string
	Password string
	IMAP     Addr
	SMTP     Addr
}

func LoadConfig

func LoadConfig(files ...string) (*Config, error)

type Mail

type Mail struct {
	Reader *mail.Reader
	// contains filtered or unexported fields
}

func (*Mail) AppendTo

func (m *Mail) AppendTo(to string)

func (*Mail) HumanHeader

func (m *Mail) HumanHeader() string

func (*Mail) SetFrom

func (m *Mail) SetFrom(from string)

type MailBuilder

type MailBuilder struct {
	Backend *SMTPReciever
	// contains filtered or unexported fields
}

A MailBuilder (implements smtp.Session) is returned after EHLO.

func (*MailBuilder) AuthPlain

func (mb *MailBuilder) AuthPlain(username, password string) error

func (*MailBuilder) Data

func (mb *MailBuilder) Data(r io.Reader) (err error)

func (*MailBuilder) Logout

func (mb *MailBuilder) Logout() error

func (*MailBuilder) Mail

func (mb *MailBuilder) Mail(from string, opts *smtp.MailOptions) error

func (*MailBuilder) Rcpt

func (mb *MailBuilder) Rcpt(to string) error

func (*MailBuilder) Reset

func (mb *MailBuilder) Reset()

type SMTPReciever

type SMTPReciever struct {
	RcptWhitelist   map[string]bool
	RemoteWhiteList func(net.Addr) bool
	MailQueue       chan<- Mail
}

SMTPReciever implements smtp.Backend

func NewSMTPReciever

func NewSMTPReciever(RcptWhitelist map[string]bool, RemoteWhiteList func(net.Addr) bool, MailQueue chan<- Mail) *SMTPReciever

func (*SMTPReciever) NewSession

func (rcvr *SMTPReciever) NewSession(c smtp.ConnectionState, hostname string) (smtp.Session, error)

type UpdateHandlerClosure

type UpdateHandlerClosure func(UpdateHandlerFunc) UpdateHandlerFunc

type UpdateHandlerFunc

type UpdateHandlerFunc func(context.Context, *client.Client, client.Update) error

Needs to not block

func PrintAttributeChange

func PrintAttributeChange(next UpdateHandlerFunc) UpdateHandlerFunc

func PrintDeletion

func PrintDeletion(next UpdateHandlerFunc) UpdateHandlerFunc

func PrintNewMail

func PrintNewMail(next UpdateHandlerFunc) UpdateHandlerFunc

Jump to

Keyboard shortcuts

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