mail

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host       string
	Port       int
	Username   string
	Password   string
	DomainName string
	Defaults   Defaults
}

Config represents a configuration to connect to an SMTP server

type Defaults added in v0.7.1

type Defaults struct {
	DefaultTo   string
	DefaultCC   []string
	DefaultBCC  []string
	DefaultFrom string
}

Defaults is the default values for the mailer if none are explicitly mentioned

type Mail

type Mail struct {
	Subject string
	To      string
	Cc      []string
	Bcc     []string
	From    string
	Error   error
	Tpl     *template.Template
	TplData interface{}
}

Mail represents an email to be sent

type Mailer added in v0.7.1

type Mailer struct {
	*mail.SMTPClient
	Defaults   Defaults
	DomainName string
}

Mailer is the struct that is used to send mail, can only be used once connected to mailer

func (*Mailer) CheckSendable added in v0.7.1

func (m *Mailer) CheckSendable(item Mail) error

CheckSendable verifies that the email can be sent

func (*Mailer) SendMail added in v0.7.1

func (m *Mailer) SendMail(item Mail) error

SendMail sends a template email

type MailerInit added in v0.7.1

type MailerInit struct {
	SMTPServer mail.SMTPServer
	Defaults   Defaults
	DomainName string
}

MailerInit is the config store for the mailer, can be initialised once then connected multiple times

func NewMailer

func NewMailer(config Config) *MailerInit

NewMailer creates a new SMTP client

func (*MailerInit) ConnectMailer added in v0.7.1

func (m *MailerInit) ConnectMailer() *Mailer

ConnectMailer connects to the mail server

Jump to

Keyboard shortcuts

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