emailc

package
v1.4.10 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 4 Imported by: 2

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

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

func NewAttach

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

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

func (*Client) Kernel

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

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

func (*Message) WithBCC

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

func (*Message) WithCC

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

func (*Message) WithDate

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

func (*Message) WithHtml

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

func (*Message) WithReceiver

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

func (*Message) WithSender

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

func (*Message) WithText

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

func (*Message) WithTitle

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

type Option

type Option func(config *Config)

func WithHost

func WithHost(host string) Option

func WithPassword

func WithPassword(password string) Option

func WithPort

func WithPort(port int) Option

func WithUsername

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