email

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: MIT Imports: 13 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 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)
	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) (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) LogError

func (this 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 (this SendgridEmailSender) LogSuccess(rowID string)

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

func (*SendgridEmailSender) SendEmail

func (this *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) SendEmailViaVendor

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

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

func (SendgridEmailSender) SqlRunStmt

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

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

Directories

Path Synopsis
aws-ses module

Jump to

Keyboard shortcuts

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