xemail

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email struct {
	Host      string `json:"host"`      // 邮件服务器地址
	Port      int    `json:"port"`      // 邮件端口
	Username  string `json:"username"`  // 邮箱用户名
	Password  string `json:"password"`  // 邮箱秘钥
	AliasName string `json:"aliasName"` // 自定义邮件发送方别名
	Client    *gomail.Dialer
}

func NewEmail

func NewEmail(ctx context.Context, options ...Option) (*Email, error)

func (*Email) SendHtml

func (em *Email) SendHtml(toEmail string, subject string, content string) error

SendHtml 发送HTML邮件

@Description: 发送HTML邮件
@receiver c
@param toEmail 邮件接收者
@param subject 邮件主题
@param content 邮件内容
@return error

func (*Email) SendText

func (em *Email) SendText(toEmail string, subject string, content string) error

SendText 发送文本邮件

@Description:
@receiver c
@param toEmail 邮件接收者
@param subject 邮件主题
@param content 邮件内容
@return error

type Option

type Option func(*Email)

func WithAliasName

func WithAliasName(aliasName string) Option

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

Jump to

Keyboard shortcuts

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