Пример #1
0
func SendEmailedItems(context EmailedItems) error {
	var msg bytes.Buffer
	t := template.Must(template.New("SHOPPING_LIST_MESSAGE").Funcs(TEMPLATE_FUNCTIONS).Parse(SHOPPING_LIST_MESSAGE))
	err := t.Execute(&msg, context)
	if err == nil {
		sender := emailer.EmailAddress{Address: SERVER_SENDER}
		recipient := emailer.EmailAddress{Address: context.Email}
		err = emailer.Send(SHOPPING_LIST_SUBJECT, msg.String(), "text/html", &sender, &recipient, []*emailer.EmailAttachment{})
	}
	return err
}
Пример #2
0
func SendVerificationEmail(serverLink, email, code string) error {
	var msg bytes.Buffer
	t := template.Must(template.New("VERIFY_MESSAGE").Parse(VERIFY_MESSAGE))
	context := RegistrationLink{serverLink, code}
	err := t.Execute(&msg, context)
	if err == nil {
		sender := emailer.EmailAddress{Address: SERVER_SENDER}
		recipient := emailer.EmailAddress{Address: email}
		err = emailer.Send(VERIFY_SUBJECT, msg.String(), "text/html", &sender, &recipient, []*emailer.EmailAttachment{})
	}
	return err
}