Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.
Click to show internal directories.
Click to hide internal directories.