mailer

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mail

type Mail struct {
	Domain      string
	Templates   string
	Host        string
	Port        int
	Username    string
	Password    string
	Encryption  string
	FromAddress string
	FromName    string
	Jobs        chan Message
	Results     chan Result
	API         string
	APIKey      string
	APIUrl      string
}

Mail holds the information necessary to connect to an SMTP server

func (*Mail) ChooseAPI

func (m *Mail) ChooseAPI(msg Message) error

func (*Mail) ListenForMail

func (m *Mail) ListenForMail()

ListenForMail listens to the mail channel and sends mail when it receives a payload. It runs continually in the background, and sends error/success messages back on the Results channel. Note that if api and api key are set, it will prefer using an api to send mail

func (*Mail) Send

func (m *Mail) Send(msg Message) error

func (*Mail) SendSMTPMessage

func (m *Mail) SendSMTPMessage(msg Message) error

SendSMTPMessage builds and sends an email message using SMTP. This is called by ListenForMail, and can also be called directly when necessary

func (*Mail) SendUsingAPI

func (m *Mail) SendUsingAPI(msg Message, transport string) error

type Message

type Message struct {
	From        string
	FromName    string
	To          string
	Subject     string
	Template    string
	Attachments []string
	Data        interface{}
}

Message is the type for an email message

type Result

type Result struct {
	Success bool
	Error   error
}

Result contains information regarding the status of the sent email message

Jump to

Keyboard shortcuts

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