mail

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatAddress added in v0.0.3

func FormatAddress(addr *imap.Address) string

地址格式化

func FormatAddressList added in v0.0.3

func FormatAddressList(addrs []imap.Address) []string

地址列表格式化

func FormatFlags added in v0.0.3

func FormatFlags(flags []imap.Flag) []string

func ParseFlags added in v0.0.3

func ParseFlags(flags []string) []imap.Flag

Types

type Attachment

type Attachment struct {
	Path        string
	Name        string
	Data        string
	ContentType string
}

type Config

type Config struct {
	Mailbox          map[string]*MailboxConfig
	ClientName       string
	ClientVersion    string
	ClientOS         string
	ClientVendor     string
	ClientSupportURL string
}

type DefaultObject

type DefaultObject struct {
	*Mailbox
}

func (*DefaultObject) Get added in v0.0.3

func (obj *DefaultObject) Get(name string) (*Mailbox, error)

func (*DefaultObject) New

func (obj *DefaultObject) New(conf *MailboxConfig) *Mailbox

type IMAPClient added in v0.0.3

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

func (*IMAPClient) Close added in v0.0.3

func (obj *IMAPClient) Close(vm *goja.Runtime)

func (*IMAPClient) ListMailbox added in v0.0.3

func (obj *IMAPClient) ListMailbox(vm *goja.Runtime) ([]MailboxInfo, error)

func (*IMAPClient) Recv added in v0.0.3

func (obj *IMAPClient) Recv(vm *goja.Runtime, opt *RecvOption) (*RecvResult, error)

type Mail added in v0.0.3

type Mail struct {
	Uid         uint32
	From        []string
	To          []string
	Cc          []string
	Bcc         []string
	Subject     string
	Date        string
	Text        string
	Html        string
	Attachments []Attachment
	Embeds      []Attachment
	Size        int64
	Flags       []string
}

type Mailbox added in v0.0.3

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

func (*Mailbox) FormatAddr added in v0.0.3

func (obj *Mailbox) FormatAddr(name, address string) string

func (*Mailbox) OpenIMAP added in v0.0.3

func (obj *Mailbox) OpenIMAP(vm *goja.Runtime) (*IMAPClient, error)

func (*Mailbox) ParseAddr added in v0.0.3

func (obj *Mailbox) ParseAddr(addr string) (name, address string, err error)

func (*Mailbox) ParseAddrList added in v0.0.3

func (obj *Mailbox) ParseAddrList(addrs []string) ([]map[string]string, error)

func (*Mailbox) Recv added in v0.0.3

func (obj *Mailbox) Recv(vm *goja.Runtime, opt *RecvOption) (*RecvResult, error)

func (*Mailbox) Send added in v0.0.3

func (obj *Mailbox) Send(vm *goja.Runtime, to []string, subject, content string, option *SendOption) error

type MailboxConfig added in v0.0.3

type MailboxConfig struct {
	SmtpHost   string
	SmtpPort   int
	ImapHost   string
	ImapPort   int
	Username   string
	Password   string
	SenderName string
	SenderMail string
}

type MailboxInfo added in v0.0.3

type MailboxInfo struct {
	Name      string
	Delimiter string
	Attrs     []string
}

type RecvOption added in v0.0.3

type RecvOption struct {
	Tag        uint32
	Mailbox    string
	Unseen     bool
	Read       bool
	Answered   bool
	Flagged    bool
	Deleted    bool
	Since      string
	Before     string
	Limit      uint32
	MarkAsRead bool

	Subject []string
	Search  []string
	Body    []string
	From    []string
	To      []string
	Cc      []string
	Bcc     []string
	Not     []string
}

接收选项

type RecvResult added in v0.0.3

type RecvResult struct {
	List []Mail
	Tag  uint32
}

type SendOption

type SendOption struct {
	Cc          []string
	Bcc         []string
	Html        bool
	Attachments []Attachment
	Embeds      []Attachment
}

Jump to

Keyboard shortcuts

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