email

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidEmailAddress

func IsValidEmailAddress(email string) bool

IsValidEmailAddress returns true/false if a provided email address is valid

Types

type Config

type Config struct {
	Host     string
	Password string
	Port     int
	UserName string
}

A Config object tells us how to configure our email server connection

type IMailService

type IMailService interface {
	Connect() error
	Send(mail ...*Mail) error
}

IMailService provides an interface describing a service for working with email

type Mail

type Mail struct {
	Body    string
	From    *Person
	Subject string
	To      []*Person
}

Mail represents an email. Who's sending, recipients, subject, and message

type MailService

type MailService struct {
	Config *Config
	Dialer *gomail.Dialer
	Sender gomail.SendCloser
}

MailService provides methods for working with email

func NewMailService

func NewMailService(config *Config) *MailService

NewMailService creates a new instance of MailService

func (*MailService) Connect

func (s *MailService) Connect() error

Connect establishes a connections to an SMTP server

func (*MailService) Send

func (s *MailService) Send(mail ...*Mail) error

Send sends an email

type Person

type Person struct {
	Name         string
	EmailAddress string
}

A Person is someone who sends or receives email

Jump to

Keyboard shortcuts

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