email

package
v0.3.37 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadFormat        = errors.New("invalid format")
	ErrUnresolvableHost = errors.New("unresolvable host")
)
View Source
var Config = Configuration{
	Host:     "smtp.qq.com",
	Port:     "25",
	Username: "",
	Password: "",
	From:     "",
}

Config default configuration

Functions

func DialTimeout

func DialTimeout(addr string, timeout time.Duration) (c *smtp.Client, err error)

DialTimeout returns a new Client connected to an SMTP server at addr. The addr must include a port, as in "mail.example.com:smtp".

func GetName

func GetName(email string) string

GetName get name of email

func IsCompanyEmail

func IsCompanyEmail(email string) (bool, string, error)

IsCompanyEmail checks if email is a company email

func IsKnowHost

func IsKnowHost(host string) bool

func LookMX

func LookMX(domain string) ([]string, error)

func ValidateFormat

func ValidateFormat(email string) error

func ValidateHost

func ValidateHost(email string) (err error)

func VerifyEmailFormat

func VerifyEmailFormat(email string) (bool, string)

VerifyEmailFormat

Types

type Configuration

type Configuration struct {
	Host     string
	Port     string
	Username string
	Password string
	From     string
}

Configuration for mail

type Email

type Email struct {
	Auth     smtp.Auth
	Header   map[string]string
	Template *template.Template
	// contains filtered or unexported fields
}

func New

func New(smtpAddress string) *Email

func (*Email) Send

func (e *Email) Send(m *Message) (err error)

type File

type File struct {
	Name    string
	Type    string
	Content string
}

type GoMail

type GoMail struct {
	From    string
	To      []string
	Cc      []string
	Bcc     []string
	Subject string
	Content string
}

GoMail config

func (*GoMail) Send

func (gm *GoMail) Send() error

Send email

type Message

type Message struct {
	ID          string  `json:"id"`
	From        string  `json:"from"`
	To          string  `json:"to"`
	CC          string  `json:"cc"`
	Subject     string  `json:"subject"`
	BodyText    string  `json:"body_text"`
	BodyHTML    string  `json:"body_html"`
	Inlines     []*File `json:"inlines"`
	Attachments []*File `json:"attachments"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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