imap

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseMail added in v1.0.15

type BaseMail struct {
	// 邮件唯一编号
	ID uint32 `json:"id"`
	// 标题
	Subject string `json:"subject"`
	// 发件人
	FromName string `json:"from_name"`
	// 发件人地址
	// xxx@xxx.xxx
	FromAddr string `json:"from_addr"`
}

type Client

type Client struct {
	Con *client.Client
	// 当前邮箱中的邮件总数量
	Num   uint32
	Mails chan *Mail
	// contains filtered or unexported fields
}

func NewClient

func NewClient(address, user, password string, num uint32) (*Client, error)

func (*Client) GetBaseMails added in v1.0.15

func (c *Client) GetBaseMails(box string, from, till uint32) ([]BaseMail, error)

func (*Client) GetEmailByUID added in v1.0.7

func (c *Client) GetEmailByUID(boxName string, uid uint32) (*Mail, error)

通过UID获取邮件

func (*Client) Keepalive added in v1.0.7

func (c *Client) Keepalive()

通过noop保持imap连接

func (*Client) Logout

func (c *Client) Logout()

func (*Client) Reconnect

func (c *Client) Reconnect() error

func (*Client) SetAnsweredFlag

func (c *Client) SetAnsweredFlag(uid uint32) error

邮件设置AnsweredFlag

func (*Client) UnReadMailsUID added in v1.0.6

func (c *Client) UnReadMailsUID(box string) ([]uint32, error)

返回未读邮件UID

func (*Client) UnreadMails

func (c *Client) UnreadMails(box string) (int, error)

type Mail

type Mail struct {
	// 邮件基础信息
	BaseMail

	// 邮件正文
	Body string
	// 邮件主题
	Subject string
	// 收件人、抄送人
	To, Cc []string
	// 附件
	Attachments map[string]io.Reader
}

func NewMailFromMessage

func NewMailFromMessage(msg *imap.Message, section *imap.BodySectionName) (*Mail, error)

Jump to

Keyboard shortcuts

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