mail

package
v0.0.0-...-e77dc18 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Username string
	Code     string
}

MailData represents the data to be sent to the template of the mail.

type MGMailService

type MGMailService struct {
	// contains filtered or unexported fields
}

SGMailService is the sendgrid implementation of our MailService.

func NewMGMailService

func NewMGMailService(logger hclog.Logger, configs *utils.Configurations) *MGMailService

NewMGMailService returns a new instance of MGMailService

func (*MGMailService) CreateMail

func (ms *MGMailService) CreateMail(mailReq *Mail) []byte

CreateMail takes in a mail request and constructs mail type.

func (*MGMailService) NewMail

func (ms *MGMailService) NewMail(from string, to []string, subject string, mailType Type, data *Data) *Mail

NewMail returns a new mail request.

func (*MGMailService) SendMail

func (ms *MGMailService) SendMail(mailReq *Mail) error

SendMail creates a sendgrid mail from the given mail request and sends it.

type Mail

type Mail struct {
	// contains filtered or unexported fields
}

Mail represents a email request

type SGMailService

type SGMailService struct {
	// contains filtered or unexported fields
}

SGMailService is the sendgrid implementation of our MailService.

func NewSGMailService

func NewSGMailService(logger hclog.Logger, configs *utils.Configurations) *SGMailService

NewSGMailService returns a new instance of SGMailService

func (*SGMailService) CreateMail

func (ms *SGMailService) CreateMail(mailReq *Mail) []byte

CreateMail takes in a mail request and constructs a sendgrid mail type.

func (*SGMailService) NewMail

func (ms *SGMailService) NewMail(from string, to []string, subject string, mailType Type, data *Data) *Mail

NewMail returns a new mail request.

func (*SGMailService) SendMail

func (ms *SGMailService) SendMail(mailReq *Mail) error

SendMail creates a sendgrid mail from the given mail request and sends it.

type Service

type Service interface {
	CreateMail(mailReq *Mail) []byte
	SendMail(mailReq *Mail) error
	NewMail(from string, to []string, subject string, mailType Type, data *Data) *Mail
}

Service represents the interface for our mail service.

type Type

type Type int
const (
	MailConfirmation Type = iota + 1
	PassReset
)

List of Mail Types we are going to send.

Jump to

Keyboard shortcuts

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