mail

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const UID_NAME = "X-Mirror-Uid"

Variables

This section is empty.

Functions

func ConvertToUTF8

func ConvertToUTF8(b []byte, charset string) ([]byte, error)

Convert gbk等转为utf-8 bytes

func Decode

func Decode(encoding byte, text string) ([]byte, error)

func ImapLogin

func ImapLogin(host string, port int, username string, password string, ssl bool) (*client.Client, error)

func IsGBK

func IsGBK(data []byte) bool

func IsUTF8

func IsUTF8(data []byte) bool

func IsUTF8String

func IsUTF8String(s string) bool

func MailDecodeHeader

func MailDecodeHeader(s string) (string, error)

MailDecodeHeader 自行处理strHeader,类似=?GB2312?B?1tDOxLi9vP6y4srU?=

func QDecode

func QDecode(s string) ([]byte, error)

QDecode decodes a Q encoded string.

func SMTPLogin

func SMTPLogin(host string, port int, username string, password string, ssl bool) (gomail.SendCloser, error)

func SendMail

func SendMail(c gomail.SendCloser, sendConfig *SendConfig) error

Types

type CommonError

type CommonError struct {
	Cause string
}

func (CommonError) Error

func (e CommonError) Error() string

type MailMessage

type MailMessage struct {
	//Uid				int
	Subject     string
	From        string
	To          string
	Uid         string
	Body        string
	Attachments []string //filenames
}

func RecvSearch

func RecvSearch(c *client.Client, bf *PreFilter, af *PostFilter) ([]MailMessage, error)

type PostFilter

type PostFilter struct {
	Subject     string
	From        string
	To          string
	Uid         string
	SentSince   string //日期格式字符串 "2006-01-02"
	Body        []string
	Attachments []string //filenames
}

PostFilter qq等邮箱使用中文过滤时会报错:imap: cannot send literal: no continuation request received 先用临时解决办法吧,PreFilter过滤条件不要输入中文,获取结果后再次过滤

type PreFilter

type PreFilter struct {
	Seen      interface{} //true,false,nil
	Subject   string
	From      string
	To        string
	Uid       string
	SentSince string //日期格式字符串 "2006-01-02"
	Body      []string
}

type SendConfig

type SendConfig struct {
	Uid         string   //自定义的邮件头
	From        string   //发件人邮箱
	To          []string //收件人邮箱,可发给多人
	Subject     string   //邮件主题
	Body        string   //邮件内容
	Attachments []string //file path
}

type WordDecoder

type WordDecoder struct {
	// CharsetReader, if non-nil, defines a function to generate
	// charset-conversion readers, converting from the provided
	// charset into UTF-8.
	// Charsets are always lower-case. utf-8, iso-8859-1 and us-ascii charsets
	// are handled by default.
	// One of the CharsetReader's result values must be non-nil.
	CharsetReader func(charset string, input io.Reader) (io.Reader, error)
}

A WordDecoder decodes MIME headers containing RFC 2047 encoded-words.

func (*WordDecoder) Convert

func (d *WordDecoder) Convert(buf *strings.Builder, charset string, content []byte) error

func (*WordDecoder) DecodeHeader

func (d *WordDecoder) DecodeHeader(header string) (string, error)

DecodeHeader decodes all encoded-words of the given string. It returns an error if and only if CharsetReader of d returns an error.

Jump to

Keyboard shortcuts

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