email

package
v1.0.53 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 25 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// The character encoding for the email.
	CharSet = "UTF-8"
)

Variables

This section is empty.

Functions

func BindFormOrJSON added in v1.0.40

func BindFormOrJSON(c *gin.Context, bindTo interface{}) (err error)

func GenUUID

func GenUUID() string

GenUUID generates a UUID and returns it.

func TimedDispatch

func TimedDispatch(em *GenericEmailSender)

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 AwsSesEmailSender added in v1.0.24

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

func (*AwsSesEmailSender) SendEmailViaVendor added in v1.0.24

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

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

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)
	SetupHandlerApi(router *gin.Engine, urlPath, key string)
	ResetLogFile(newFp *os.File)
}

func NewEmailSender

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

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

type EmailSenderImplementation added in v1.0.24

type EmailSenderImplementation interface {
	SendEmailViaVendor(rowID, fromName, fromAddress, subject, toName, toAddress, textBody, htmlBody string) (err error, result string)
}

func NewEmailSenderAwsSes added in v1.0.24

func NewEmailSenderAwsSes(f *os.File) (rv EmailSenderImplementation)

func NewEmailSenderSendgrid added in v1.0.24

func NewEmailSenderSendgrid(f *os.File) (rv EmailSenderImplementation)

type GenericEmailSender added in v1.0.24

type GenericEmailSender struct {
	SenderName string

	TheSender EmailSenderImplementation

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

func (*GenericEmailSender) GetCurTick added in v1.0.24

func (em *GenericEmailSender) GetCurTick() int

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

func (GenericEmailSender) LogError added in v1.0.24

func (em GenericEmailSender) 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 (GenericEmailSender) LogSuccess added in v1.0.24

func (em GenericEmailSender) LogSuccess(rowID string)

func (*GenericEmailSender) ResetLogFile added in v1.0.40

func (em *GenericEmailSender) ResetLogFile(newFp *os.File)

func (*GenericEmailSender) SendEmail added in v1.0.24

func (em *GenericEmailSender) 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 (*GenericEmailSender) SendEmailMapdata added in v1.0.24

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

func (*GenericEmailSender) SendEmailViaVendor added in v1.0.24

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

SendEmailViaVendor will use the underlying implemenation to send the email.

func (*GenericEmailSender) SetupHandlerApi added in v1.0.40

func (em *GenericEmailSender) SetupHandlerApi(router *gin.Engine, urlPath, AuthKey string)

SetupHandlerApi will create a handler at the specified URL path to "kick" the timed sender

func (GenericEmailSender) SqlRunStmt added in v1.0.24

func (em GenericEmailSender) 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 (*GenericEmailSender) TemplateAndSend added in v1.0.24

func (em *GenericEmailSender) TemplateAndSend()

type SendgridEmailSender

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

func (*SendgridEmailSender) SendEmailViaVendor

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

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

Directories

Path Synopsis
aws-ses module

Jump to

Keyboard shortcuts

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