smtp

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lookup

func Lookup(domain string) string

Lookup main smtp server by service domain

Types

type Client

type Client struct {
	Client chan *email.Email
	// contains filtered or unexported fields
}

Client smtp with queue

func NewClient

func NewClient(ctx context.Context, conf ClientConfig) (*Client, error)

NewClient smtp with queue

func (*Client) Close

func (c *Client) Close(waitForSendRemaining bool)

Close send Client

func (*Client) Prepare

func (c *Client) Prepare(msg *email.Email) error

Prepare email

func (*Client) Send

func (c *Client) Send(msg *email.Email) error

Send email

func (*Client) SendNow

func (c *Client) SendNow(msg *email.Email) ([]byte, error)

SendNow email, without enClient

func (*Client) Wait

func (c *Client) Wait()

Wait for send remaiming

type ClientConfig

type ClientConfig struct {
	Server string `yaml:"server"` // smtp server, auto lookup by default
	Port   uint16 `yaml:""`       // possible: 25/2525 (unsafe), 587 (TLS), 465 (SSL) // 587 by default

	Username string `yaml:"username"` // required, usually email
	Password string `yaml:"password"` // optional, raw password

	FromMail string `yaml:"from_mail"` // optional, Username by default
	FromName string `yaml:"from_name"` // optional, Username prefix by default

	DefaultTo  []string `yaml:"default_to"`  // recipients
	DefaultCc  []string `yaml:"default_cc"`  // recipients, carbon copy
	DefaultBcc []string `yaml:"default_bcc"` // recipients, blind carbon copy

	SendQueueSize int `yaml:"send_queue_size"`
	// contains filtered or unexported fields
}

ClientConfig for smtp sender

func (*ClientConfig) ValidAndRepair

func (c *ClientConfig) ValidAndRepair() error

ValidAndRepair smtp config

Jump to

Keyboard shortcuts

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