feat(emailApi): adjusted email template
Build and Push Docker image / build-and-push (push) Successful in 3m49s Details

This commit is contained in:
Valentin Kolb 2024-10-24 19:39:02 +02:00
parent beea0ca329
commit 95a8b447cf
2 changed files with 17 additions and 13 deletions

View File

@ -26,7 +26,8 @@ func sendEmailToUser(app *pocketbase.PocketBase, registry *template.Registry, re
"html/blankEmail.html",
).Render(map[string]any{
"APP_URL": app.Settings().Meta.AppUrl,
"SENDER": sender.Username(),
"SENDER_SN": sender.GetString("sn"),
"SENDER_GIVENNAME": sender.GetString("givenName"),
"SENDER_EMAIL": senderEmail,
"CONTENT": emailRecord.GetString("content"),
})
@ -50,6 +51,7 @@ func sendEmailToUser(app *pocketbase.PocketBase, registry *template.Registry, re
To: []mail.Address{{Address: recipientEmail}},
Subject: "[StuVe IT] " + subject,
HTML: html,
Headers: headers,
}
if err := app.NewMailClient().Send(email); err != nil {
currentErrors := emailRecord.GetString("errors")
@ -81,7 +83,7 @@ func sendEmails(app *pocketbase.PocketBase, emailRecord *models.Record) {
// InitEmailApi initializes the email notifier
//
// the function sends an email notification after it was created
func InitEmailApi(app *pocketbase.PocketBase, e *core.ServeEvent) error {
func InitEmailApi(app *pocketbase.PocketBase, _ *core.ServeEvent) error {
logger.LogInfoF("Adding email notifier")

View File

@ -47,18 +47,20 @@
</style>
<div class="stack">
<div class="container">
<h1 class="blue-text">Hallo 👋,</h1>
<p>Du hast eine neue Nachricht von {{.SENDER_NAME}} ({{.SENDER_EMAIL}})</p>
<br/>
<div>
<p>{{.CONTENT}}</p>
<h1 class="blue-text">You got mail 📩!</h1>
<p>Du hast eine E-Mail von {{.SENDER_GIVENNAME}} {{.SENDER_SN}} ({{.SENDER_EMAIL}})</p>
</div>
<div class="container">
{{.CONTENT}}
</div>
<div class="container">
<p>Du kannst {{.SENDER_GIVENNAME}} {{.SENDER_SN}} antworten, indem du auf den untenstehenden Button klickst.</p>
<br/>
<br/>
<a class="action-btn" href="mailto:{{.SENDER_EMAIL}}?subject=Re: {{.SUBJECT}}">↩ Antworten</a>
</div>
<div class="container">
<div class="group">
<svg class="logo" width="100%" height="100%" viewBox="0 0 100 100" version="1.1"
<svg class="logo" width="100%" height="100%" viewBox="0 0 100 100"
xmlns="http://www.w3.org/2000/svg"
xml:space="preserve"
style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">