imap

package
v0.11.0-advanced Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(s *models.IMAP) error

Validate validates supplied IMAP model by connecting to the server

Types

type Client

type Client interface {
	Login(username, password string) (cmd *imap.Command, err error)
	Logout(timeout time.Duration) (cmd *imap.Command, err error)
	Select(name string, readOnly bool) (mbox *imap.MailboxStatus, err error)
	Store(seq *imap.SeqSet, item imap.StoreItem, value interface{}, ch chan *imap.Message) (err error)
	Fetch(seqset *imap.SeqSet, items []imap.FetchItem, ch chan *imap.Message) (err error)
}

Client interface for IMAP interactions

type Email

type Email struct {
	SeqNum uint32 `json:"seqnum"`
	*email.Email
}

Email represents an email.Email with an included IMAP Sequence Number

type Mailbox

type Mailbox struct {
	Host             string
	TLS              bool
	IgnoreCertErrors bool
	User             string
	Pwd              string
	Folder           string
	// Read only mode, false (original logic) if not initialized
	ReadOnly bool
}

Mailbox holds onto the credentials and other information needed for connecting to an IMAP server.

func (*Mailbox) DeleteEmails

func (mbox *Mailbox) DeleteEmails(seqs []uint32) error

DeleteEmails will delete emails from the supplied slice of SeqNums

func (*Mailbox) GetUnread

func (mbox *Mailbox) GetUnread(markAsRead, delete bool) ([]Email, error)

GetUnread will find all unread emails in the folder and return them as a list.

func (*Mailbox) MarkAsUnread

func (mbox *Mailbox) MarkAsUnread(seqs []uint32) error

MarkAsUnread will set the UNSEEN flag on a supplied slice of SeqNums

type Monitor

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

Monitor is a worker that monitors IMAP servers for reported campaign emails

func NewMonitor

func NewMonitor() *Monitor

NewMonitor returns a new instance of imap.Monitor

func (*Monitor) Shutdown

func (im *Monitor) Shutdown() error

Shutdown attempts to gracefully shutdown the IMAP monitor.

func (*Monitor) Start

func (im *Monitor) Start() error

Start launches the IMAP campaign monitor

Jump to

Keyboard shortcuts

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