email

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotSupportAuth auth failed error
	ErrNotSupportAuth = errors.New("smtp: server doesn't support AUTH")
	// ErrNoReceiver reciver is empty error
	ErrNoReceiver = errors.New("mail: no receiver")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	To   []string   `json:"to"`
	SMTP SmtpConfig `json:"SMTP"`
}

Config smtp config

func Example

func Example() *Config

Example return an email config example

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig if Email config exists, return email config

func (*Config) LoginTest

func (cfg *Config) LoginTest() error

LoginTest return nil, expect cannot login to the server

func (*Config) Send

func (cfg *Config) Send(nickName, subject, body string) error

Send send mail on STARTTLS/TLS port

type SmtpConfig

type SmtpConfig struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	TLS      bool   `json:"TLS"`
	Username string `json:"username"`
	Password string `json:"password"`
}

SmtpConfig smtp config

Jump to

Keyboard shortcuts

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