smtp

package
v0.0.0-...-91e7bcc Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	DefaultTmplData map[string]interface{} // DefaultTmplData stores default data for templates.
	// contains filtered or unexported fields
}

Client represents SMTP for sending mail.

func New

func New(cfg Config) (*Client, error)

New starts a daemon channel and receives and send messages.

func (*Client) Close

func (c *Client) Close()

Close daemon will not accepting email to send.

func (*Client) Send

func (c *Client) Send(to []string, subject, text string) error

Send a simple text email.

func (*Client) SendHTML

func (c *Client) SendHTML(to []string, subject, tmpl string, data map[string]interface{}) error

SendHTML sends an email with HTML header. Provided template data will override default template data.

func (*Client) SetTemplatePath

func (c *Client) SetTemplatePath(path string) error

SetTemplatePath set template path location and parses them. Uses embedded mail templates if path is not set.

type Config

type Config struct {
	// Login credentials.
	Addr string
	Port int
	User string
	Pass string
	// Display name.
	Name string
	// HTML template path
	Tmpl string
}

Config represents SMTP credentials and template path.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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