mirror of
https://github.com/KevinMidboe/planetposen-mail.git
synced 2025-10-29 17:50:32 +00:00
Mail api for sending order confirmation to planetposen customers
This commit is contained in:
26
mail/template.go
Normal file
26
mail/template.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package mail
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func buildOrderConfirmation(templateData EmailTemplateData) *OrderConfirmationEmailData {
|
||||
subject := "Orderbekreftelse fra planetposen.no"
|
||||
|
||||
data := &OrderConfirmationEmailData{
|
||||
Subject: subject,
|
||||
FromName: "noreply@kevm.dev",
|
||||
FromEmail: "noreply@kevm.dev",
|
||||
}
|
||||
|
||||
tmpl := template.Must(template.ParseFiles("mail/mail-template_order-confirmation.html"))
|
||||
b := new(strings.Builder)
|
||||
err := tmpl.Execute(b, templateData)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
data.Markup = b.String()
|
||||
return data
|
||||
}
|
||||
Reference in New Issue
Block a user