imap

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Request

func Request(data map[string]any, opts ...Option) (map[string]any, error)

func Spec added in v1.30.0

func Spec() actionspec.Spec

Spec declares the imap action. It keeps to no guard, as it does not check what it is about to do against one, so that a guard refuses it unless it is allowed by name. It cannot run without host, username and password; port is 993 when it is not given.

Types

type Action

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

func (*Action) Run

func (a *Action) Run(with map[string]any) (map[string]any, error)

type Callback

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

type Command

type Command struct {
	Name       string   `map:"name" validate:"required"`
	Mailbox    string   `map:"mailbox"`
	OldMailbox string   `map:"oldmailbox"`
	NewMailbox string   `map:"newmailbox"`
	Reference  string   `map:"reference"`
	Pattern    string   `map:"pattern"`
	Criteria   Criteria `map:"criteria"`
	Sequence   string   `map:"sequence"`
	Dataitem   string   `map:"dataitem"`
	Value      string   `map:"value"`
}

Without login, logout and Expunge

type CopyData

type CopyData struct {
	Success bool `map:"success"`
	Count   int  `map:"count"`
}

type CreateData

type CreateData struct {
	Success bool   `map:"success"`
	Mailbox string `map:"mailbox"`
}

type Criteria

type Criteria struct {
	SeqNums    []string          `map:"seq_nums"`
	UIDs       []string          `map:"uids"`
	Since      string            `map:"since"`
	Before     string            `map:"before"`
	SentSince  string            `map:"sent_since"`
	SentBefore string            `map:"sent_before"`
	Headers    map[string]string `map:"headers"`
	Bodies     []string          `map:"bodies"`
	Texts      []string          `map:"texts"`
	Flags      []string          `map:"flags"`
	NotFlags   []string          `map:"not_flags"`
}

type Data

type Data struct {
	Select      SelectData `map:"select"`
	Examine     SelectData `map:"examine"`
	Search      SearchData `map:"search"`
	List        ListData   `map:"list"`
	Fetch       FetchData  `map:"fetch"`
	Store       StoreData  `map:"store"`
	Copy        CopyData   `map:"copy"`
	Create      CreateData `map:"create"`
	Delete      DeleteData `map:"delete"`
	Rename      RenameData `map:"rename"`
	Subscribe   StatusData `map:"subscribe"`
	Unsubscribe StatusData `map:"unsubscribe"`
	Noop        NoopData   `map:"noop"`
}

type DeleteData

type DeleteData struct {
	Success bool   `map:"success"`
	Mailbox string `map:"mailbox"`
}

type FetchData

type FetchData struct {
	Messages []Message `map:"messages"`
	Count    int       `map:"count"`
}

type ListData

type ListData struct {
	Mailboxes []MailboxInfo `map:"mailboxes"`
	Count     int           `map:"count"`
}

type MailboxInfo

type MailboxInfo struct {
	Name       string   `map:"name"`
	Attributes []string `map:"attributes"`
	Delimiter  string   `map:"delimiter"`
}

type Message

type Message struct {
	UID   int      `map:"uid"`
	Flags []string `map:"flags"`
	// Date is the envelope's Date in RFC 3339, such as
	// 2025-10-08T07:11:55Z. A time.Time came out of the result as an empty
	// map.
	Date     string            `map:"date"`
	From     string            `map:"from"`
	To       string            `map:"to"`
	Subject  string            `map:"subject"`
	Body     string            `map:"body"`
	HTMLBody string            `map:"html_body"`
	Size     int               `map:"size"`
	Headers  map[string]string `map:"headers"`
}

Message represents an email message

type NoopData

type NoopData struct {
	Success bool `map:"success"`
}

type Option

type Option func(*Callback)

func WithAfter

func WithAfter(f func(res *Res)) Option

func WithBefore

func WithBefore(f func(req *Req)) Option

type RenameData

type RenameData struct {
	Success    bool   `map:"success"`
	OldMailbox string `map:"old_mailbox"`
	NewMailbox string `map:"new_mailbox"`
}

type Req

type Req struct {
	Host            string        `map:"host" validate:"required"`
	Port            int           `map:"port"`
	Username        string        `map:"username" validate:"required"`
	Password        string        `map:"password" validate:"required"`
	TLS             bool          `map:"tls"`
	Timeout         time.Duration `map:"timeout"`
	InsecureSkipTLS bool          `map:"insecure_skip_tls"`
	Commands        []Command     `map:"commands"`
	// contains filtered or unexported fields
}

func NewReq

func NewReq() *Req

func (*Req) Do

func (r *Req) Do() (*Result, error)

Do connects, logs in, runs the commands in one session and logs out.

type Res

type Res struct {
	Code  int    `map:"code"`
	Data  Data   `map:"data"`
	Error string `map:"error"`
}

type Result

type Result struct {
	Req    Req           `map:"req"`
	Res    Res           `map:"res"`
	RT     time.Duration `map:"rt"`
	Status int           `map:"status"`
}

type SearchData

type SearchData struct {
	All   string `map:"all"`
	Min   int    `map:"min"`
	Max   int    `map:"max"`
	Count int    `map:"count"`
}

type SelectData

type SelectData struct {
	Exists         int      `map:"exists"`
	Recent         int      `map:"recent"`
	FirstUnseen    int      `map:"first_unseen"`
	UIDNext        int      `map:"uid_next"`
	Flags          []string `map:"flags"`
	PermanentFlags []string `map:"permanent_flags"`
}

type StatusData

type StatusData struct {
	Success bool   `map:"success"`
	Mailbox string `map:"mailbox"`
}

type StoreData

type StoreData struct {
	Success bool `map:"success"`
	Count   int  `map:"count"`
}

Jump to

Keyboard shortcuts

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