email

package
v0.0.0-...-626c64f Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TextEmail type for plain text emails
	TextEmail = Type("text")
	// HTMLEmail type for HTML emails
	HTMLEmail = Type("html")
)

Variables

View Source
var Templates map[string]string

Functions

func Init

func Init(cnf config.EmailConfig)

Init initalizes package with correct configurations

func NewGmail

func NewGmail(config config.EmailConfig) (*Gmail, *Error)

NewGmail creates a new Gmail sender

func NewSender

func NewSender() (Sender, *Error)

NewSender creates a new sender depending on the provider specified in EmailConfig

Types

type Email

type Email struct {
	Type     Type
	Subject  string
	Body     string
	From     string
	To       string
	CC       []string
	Template ITemplate
}

Email is the email object to send

func (Email) FormMessage

func (e Email) FormMessage() (msg string, err error)

FormMessage properly forms the Email message in RFC 822-style

type Error

type Error struct {
	Message string
	Inner   error
}

Error structue to handle Email related errors

func NewError

func NewError(msg string, inner error) *Error

NewError creates a new EmailError

func (Error) Error

func (e Error) Error() string

Error returns error string

type Gmail

type Gmail struct {
	Config config.EmailConfig
}

Gmail is the provider to send emails thru google mail

func (Gmail) Send

func (g Gmail) Send(email *Email) (eErr *Error)

Send sends an email

type ITemplate

type ITemplate interface {
	Process() (string, error)
}

ITemplate is the interface to use to be able to have diffent types of templates for emails

type SES

type SES struct {
}

SES is the Email sender for AWS SES

type Sender

type Sender interface {
	Send(*Email) *Error
}

Sender is the object to use for Email

type Type

type Type string

Type of the type of email we are going to send

Directories

Path Synopsis
templates

Jump to

Keyboard shortcuts

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