hmail

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

README

邮件收发

使用IMAP收取邮件

使用方法

mail,err = hmail.ImapFetchSince(auth,time)  // 收指定时间内的邮件

使用SMTP发送邮件

使用方法

err = hmail.SmtpSend(mail,auth)

腾讯企业邮箱

接收服务器:    
imap.exmail.qq.com(使用SSL,端口号993)   
发送服务器:   
smtp.exmail.qq.com(使用SSL,端口号465)  

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImapClient

func ImapClient(auth *Auth) (c *client.Client, err error)

func SmtpSend

func SmtpSend(m *Mail, a *Auth) (err error)

SmtpSend 发送邮件

Types

type Attach

type Attach struct {
	FileName    string // 文件名
	ContentType string // 文件类型
	Bytes       []byte // 文件内容
}

type Auth

type Auth struct {
	Addr     string // 使用SSL邮件服务器,发邮件是SMTP服务器,收邮件是IMAP服务器
	Username string
	Password string
}

type Criteria

type Criteria struct {
	Search *imap.SearchCriteria // 邮件查询条件
}

type Mail

type Mail struct {
	From    string    // 发件名称,可为空
	To      []string  // 收件邮箱,必填
	Cc      []string  // 抄送,可选
	Bcc     []string  // 密送,可选
	Subject string    // 邮件标题,必填
	Text    string    // 邮件文本内容 Text 与 Html 二选一
	Html    string    // 邮件HTML内容
	Attach  []*Attach // 邮件附件
	Date    time.Time // 邮件时间
}

func ImapFetchLatest

func ImapFetchLatest(auth *Auth, num uint32) (list []*Mail, err error)

ImapFetchLatest 收取最新N个邮件

func ImapFetchSince

func ImapFetchSince(auth *Auth, timeSince time.Time, timeBefore time.Time) (list []*Mail, err error)

ImapFetchSince 收取指定时间之后的邮件

Jump to

Keyboard shortcuts

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