mail

package
v0.0.0-...-74836cc Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectImap

func ConnectImap(conf *config.ServerConfig) (*client.Client, error)

func MakeMessage

func MakeMessage(from *string, to *string, subject *string, body *string) string

func RangeLastN

func RangeLastN(n uint32, total uint32) (uint32, uint32)

func RangeSeq

func RangeSeq(from uint32, to uint32) *imap.SeqSet

Types

type Mail

type Mail struct {
	MessageId string
	From      string
	Subject   string
	Location  *time.Location
}

type MailFetchError

type MailFetchError struct {
	Conf config.Config
	Err  error
}

func (*MailFetchError) Error

func (mfe *MailFetchError) Error() string

func (*MailFetchError) Unwrap

func (mfe *MailFetchError) Unwrap() error

type MailFetcher

type MailFetcher struct {
	Conf        *config.Config
	MaxMessages uint32
	Done        <-chan bool
	Mail        chan<- *Mail
	Errors      chan<- error
}

func NewMailFetcher

func NewMailFetcher(
	conf *config.Config, maxMessages uint32, done <-chan bool,
) (*MailFetcher, <-chan *Mail, <-chan error)

func (*MailFetcher) Close

func (f *MailFetcher) Close()

func (*MailFetcher) Run

func (f *MailFetcher) Run()

func (*MailFetcher) RunOnce

func (f *MailFetcher) RunOnce()

type SmtpClient

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

func ConnectSmtp

func ConnectSmtp(conf *config.ServerConfig) (*SmtpClient, error)

func (*SmtpClient) Quit

func (client *SmtpClient) Quit() error

func (*SmtpClient) Send

func (client *SmtpClient) Send(to string, subject string, body string) error

type SmtpSender

type SmtpSender struct {
	Conf *config.ServerConfig
}

SmtpSender uses a new connection for every e-mail.

func (*SmtpSender) Send

func (s *SmtpSender) Send(to string, subject string, body string) error

Jump to

Keyboard shortcuts

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