emailc

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HostQQMail = "smtp.qq.com"
	HostExmail = "smtp.exmail.qq.com"
	PortQQMail = 25
	PortExmail = 465
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attach added in v1.3.0

type Attach struct {
	// Name 附件文件名称
	Name string
	// File 附件文件Reader
	File io.Reader
}

func NewAttach added in v1.3.0

func NewAttach(name string, file io.Reader) Attach

type Client

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

func NewClient

func NewClient(options ...Option) (*Client, error)

func NewClientWithConfig added in v1.3.0

func NewClientWithConfig(config Config) (*Client, error)

func (*Client) Kernel added in v1.3.0

func (client *Client) Kernel() *gomail.Dialer

func (*Client) Send

func (client *Client) Send(message *Message) error

type Config

type Config struct {
	Host     string `mapstructure:"host" json:"host"`
	Port     int    `mapstructure:"port" json:"port"`
	Username string `mapstructure:"username" json:"username"`
	Password string `mapstructure:"password" json:"password"`
}

type Message

type Message struct {
	// Sender 发件者邮箱地址
	Sender string
	// Receiver 收件者邮箱地址
	Receiver []string
	// Title 邮件标题
	Title string
	// Text 邮件文本内容, 设置后 Html 失效
	Text string
	// 邮件HTML富文本内容, 设置后 Text 失效
	Html string
	// Date 发件时间
	Date time.Time
	// CC 抄送人邮箱地址
	CC []string
	// BCC 密送人邮箱地址
	BCC    []string
	Attach []Attach
}

func NewMessage

func NewMessage() *Message

func (*Message) WithAttach added in v1.3.0

func (msg *Message) WithAttach(attach ...Attach) *Message

func (*Message) WithBCC added in v1.3.0

func (msg *Message) WithBCC(bcc ...string) *Message

func (*Message) WithCC added in v1.3.0

func (msg *Message) WithCC(cc ...string) *Message

func (*Message) WithDate added in v1.3.0

func (msg *Message) WithDate(date time.Time) *Message

func (*Message) WithHtml added in v1.3.0

func (msg *Message) WithHtml(html string) *Message

func (*Message) WithReceiver added in v1.3.0

func (msg *Message) WithReceiver(receiver ...string) *Message

func (*Message) WithSender added in v1.3.0

func (msg *Message) WithSender(sender string) *Message

func (*Message) WithText added in v1.3.0

func (msg *Message) WithText(text string) *Message

func (*Message) WithTitle added in v1.3.0

func (msg *Message) WithTitle(title string) *Message

type Option added in v1.3.0

type Option func(config *Config)

func WithHost added in v1.3.0

func WithHost(host string) Option

func WithPassword added in v1.3.0

func WithPassword(password string) Option

func WithPort added in v1.3.0

func WithPort(port int) Option

func WithUsername added in v1.3.0

func WithUsername(username string) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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