mailer

package module
v0.0.0-...-b45dc3e Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingField = errors.New("missing field is required")

Functions

func HandleSendActivationEmail

func HandleSendActivationEmail(mailerService *Service) http.HandlerFunc

func SendActivationEmail

func SendActivationEmail(mailerService *Service) lambdaHandler

HandleSendActivationEmail is a lambda function that sends an email to a user. It is accessed through an AWS API Gateway.

Types

type ActivationData

type ActivationData struct {
	Name      string `json:"name"`
	Hyperlink string `json:"HyperLink"`
}

type ActivationEmailData

type ActivationEmailData struct {
	From           string `json:"from"`
	To             string `json:"to"`
	Subject        string `json:"subject"`
	ActivationData `json:"activationData"`
}

type EmailActivationData

type EmailActivationData struct {
	From                string `json:"from"`
	To                  string `json:"to"`
	Subject             string `json:"subject"`
	Name                string `json:"name"`
	ActivationHyperlink string `json:"activationHyperLink"`
}

UserActivationData stores information needed to send an email to a user with instructions for activating their account.

type GrpcServer

type GrpcServer struct {
	pb.UnimplementedMailerServer
	// contains filtered or unexported fields
}

func NewGrpcServer

func NewGrpcServer(mailerService *Service) GrpcServer

func (GrpcServer) SendActivationEmail

func (gs GrpcServer) SendActivationEmail(ctx context.Context, r *pb.EmailRequest) (*pb.Response, error)

SendActivationEmail is a grpc implementation that can be called by other services to send an activation email to a user.

type Mailer

type Mailer interface {
	// contains filtered or unexported methods
}

Mailer defines methods for receiving data to send emails.

func NewMailer

func NewMailer(username, password, host string, port int) Mailer

type Service

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

Service defines methods that receive email data inputs, and prepares and validates those inputs before calling methods from the Mailer type to send that data out in an email. It can be implemented by any infrastructure to send emails.

func NewService

func NewService(mailer Mailer, emailTemplatesDir string) *Service

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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