email

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenUUID

func GenUUID() string

GenUUID generates a UUID and returns it.

func TimedDispatch

func TimedDispatch(em *SendgridEmailSender)

func XData

func XData(x ...interface{}) (rv string)

XData convers a list of parameters to a JSON data showing what the list contains. This is returned as a string.

Types

type EmailSender

type EmailSender interface {
	SendEmailViaVendor(rowID, fromName, fromAddress, subject, toName, toAddress, textBody, htmlBody string) (err error)
	SendEmail(template_name string, param ...interface{}) (err error)
	SendEmailMapdata(template_name string, mdata map[string]interface{}) (err error)
	LogError(rowID, msg string, err error)
	LogSuccess(rowID string)
}

func NewEmailSender

func NewEmailSender(gcfg *data.BaseConfigType, db map[string]bool, f *os.File, conn *pgxpool.Pool, ctx context.Context, lgr *zap.Logger, xmd *metrics.MetricsData) (rv EmailSender)

type SendgridEmailSender

type SendgridEmailSender struct {

	// Debug flags like prevent send of email for testing
	DbFlag map[string]bool
	// contains filtered or unexported fields
}

func (*SendgridEmailSender) GetCurTick

func (em *SendgridEmailSender) GetCurTick() int

GetCurTics returns the number of times that a timeout has saved the data.

func (SendgridEmailSender) LogError

func (em SendgridEmailSender) LogError(rowID, msg string, err error)

-------------------------------------------------------------------------------------------------------------------------

CREATE TABLE if not exists q_qr_email_log (
	  email_email_id		uuid DEFAULT uuid_generate_v4() not null primary key
	, updated 			timestamp
	, created 			timestamp default current_timestamp not null
	, user_id			uuid
	, state				text
	, error_msg			text
	, email_data		text
);

func (SendgridEmailSender) LogSuccess

func (em SendgridEmailSender) LogSuccess(rowID string)

-------------------------------------------------------------------------------------------------------------------------

func (*SendgridEmailSender) SendEmail

func (em *SendgridEmailSender) SendEmail(template_name string, param ...interface{}) (err error)

------------------------------------------------------------------------------------------------------------------------- SendEmail combines a base template name with globacl configuration on where to find the templates and turns that into all the parts of an email, then calls SendEmailViaVendor to send the email.

func (*SendgridEmailSender) SendEmailMapdata

func (em *SendgridEmailSender) SendEmailMapdata(template_name string, mdata map[string]interface{}) (err error)

func (*SendgridEmailSender) SendEmailViaVendor

func (em *SendgridEmailSender) SendEmailViaVendor(rowID, fromName, fromAddress, subject, toName, toAddress, textBody, htmlBody string) (err error)

-------------------------------------------------------------------------------------------------------------------------

func (SendgridEmailSender) SqlRunStmt

func (em SendgridEmailSender) SqlRunStmt(stmt string, encPat string, data ...interface{}) (rv []map[string]interface{}, err error)

SqlRunStmt will run a single statemt and return the data as an array of maps

func (*SendgridEmailSender) TemplateAndSend

func (em *SendgridEmailSender) TemplateAndSend()

Directories

Path Synopsis
aws-ses module

Jump to

Keyboard shortcuts

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