entries

package
v0.0.0-...-7d8d956 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeEmailContentProcessor

func MakeEmailContentProcessor(requiredToAddress string, db *sql.DB, logger *log.Logger) model.EmailContentProcessor

func RunDailyEmailTask

func RunDailyEmailTask(db *sql.DB, emailGateway EmailGateway, requiredToAddress, mattEmailAddress string, logger *log.Logger)

RunDailyEmailTask starts a goroutine that triggers SendDailyEmails daily at 9 AM Eastern Time.

func SendDailyEmails

func SendDailyEmails(db *sql.DB, emailGateway EmailGateway, requiredToAddress, mattEmailAddress string, logger *log.Logger, now time.Time)

SendDailyEmails sends prompt emails to users, catching up on any missed days. Assumes there is always at least one existing prompt for user_id=1. now is the current time to use for determining the date range.

Types

type EmailGateway

type EmailGateway interface {
	SendPrompt(toName, toEmail, fromName, fromEmail, subject, body string) (messageID string, err error)
}

EmailGateway defines the interface for sending email prompts.

type SendGridGateway

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

SendGridGateway implements EmailGateway using the SendGrid API.

func NewSendGridGateway

func NewSendGridGateway(apiKey string) *SendGridGateway

NewSendGridGateway creates a new SendGridGateway with the given API key.

func (*SendGridGateway) SendPrompt

func (g *SendGridGateway) SendPrompt(toName, toEmail, fromName, fromEmail, subject, body string) (string, error)

SendPrompt sends an HTML email prompt via SendGrid and returns the message ID.

Jump to

Keyboard shortcuts

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