diff --git a/emailApi/main.go b/emailApi/main.go index f9da1d0..ce61b27 100644 --- a/emailApi/main.go +++ b/emailApi/main.go @@ -28,6 +28,9 @@ func sendEmailToUser(app *pocketbase.PocketBase, registry *template.Registry, re recipientEmail := recipient.GetString("email") senderEmail := sender.GetString("email") + // get email subject + subject := "[StuVe IT] " + emailRecord.GetString("subject") + // render email template html, err := registry.LoadFiles( "html/blankEmail.html", @@ -37,6 +40,7 @@ func sendEmailToUser(app *pocketbase.PocketBase, registry *template.Registry, re "SENDER_GIVENNAME": sender.GetString("givenName"), "SENDER_EMAIL": senderEmail, "CONTENT": safeContent, + "SUBJECT": subject, }) if err != nil { currentErrors := emailRecord.GetString("errors") @@ -45,9 +49,6 @@ func sendEmailToUser(app *pocketbase.PocketBase, registry *template.Registry, re return } - // get email subject - subject := emailRecord.GetString("subject") - // set reply-to header headers := make(map[string]string) headers["Reply-To"] = senderEmail @@ -59,7 +60,7 @@ func sendEmailToUser(app *pocketbase.PocketBase, registry *template.Registry, re Name: app.Settings().Meta.SenderName, }, To: []mail.Address{{Address: recipientEmail}}, - Subject: "[StuVe IT] " + subject, + Subject: subject, HTML: html, Headers: headers, } diff --git a/html/blankEmail.html b/html/blankEmail.html index c41955c..f680b62 100644 --- a/html/blankEmail.html +++ b/html/blankEmail.html @@ -48,15 +48,18 @@
Du hast eine E-Mail von {{.SENDER_GIVENNAME}} {{.SENDER_SN}} ({{.SENDER_EMAIL}})
++ Du hast eine E-Mail von {{.SENDER_GIVENNAME}} {{.SENDER_SN}} ({{.SENDER_EMAIL}}) +
Du kannst {{.SENDER_GIVENNAME}} {{.SENDER_SN}} antworten, indem du auf den untenstehenden Button klickst.
+Du kannst {{.SENDER_GIVENNAME}} {{.SENDER_SN}} antworten, indem du auf den untenstehenden Button klickst: