If you didn't request this link, you can safely ignore this email.
`))
// MagicLinkData holds template data for the magic link email.
type MagicLinkData struct {
MagicLinkURL string
}
// RenderMagicLinkEmail renders the magic link HTML email.
func RenderMagicLinkEmail(data MagicLinkData) (html, text string, err error) {
var buf bytes.Buffer
if err := magicLinkTemplate.Execute(&buf, data); err != nil {
return "", "", fmt.Errorf("render magic link template: %w", err)
}
textBody := fmt.Sprintf("Sign in to Pulse\n\nClick this link to sign in: %s\n\nThis link expires in 15 minutes. If you didn't request this, ignore this email.", data.MagicLinkURL)
return buf.String(), textBody, nil
}
var trialVerificationTemplate = template.Must(template.New("trial_verification").Parse(`
Verify your Pulse Pro trial request
Verify your Pulse Pro trial request
Confirm this email address to continue setting up your 14-day Pulse Pro trial. This link expires in 20 minutes.
If you did not request a Pulse Pro trial, you can safely ignore this email.
`))
// TrialVerificationData holds template data for the trial verification email.
type TrialVerificationData struct {
VerifyURL string
}
// RenderTrialVerificationEmail renders the trial verification HTML email.
func RenderTrialVerificationEmail(data TrialVerificationData) (html, text string, err error) {
var buf bytes.Buffer
if err := trialVerificationTemplate.Execute(&buf, data); err != nil {
return "", "", fmt.Errorf("render trial verification template: %w", err)
}
textBody := fmt.Sprintf(
"Verify your Pulse Pro trial request\n\nConfirm your email to continue setting up your 14-day Pulse Pro trial: %s\n\nThis link expires in 20 minutes. If you didn't request this, ignore this email.",
data.VerifyURL,
)
return buf.String(), textBody, nil
}