Füge Message-Id zur Mail hinzu

This commit is contained in:
Gonne 2022-09-26 14:17:25 +02:00
parent c9883b0d3f
commit d28d3e21ee
2 changed files with 6 additions and 3 deletions

View file

@ -7,6 +7,7 @@ import (
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"html/template"
"log" "log"
"math/big" "math/big"
"net/smtp" "net/smtp"
@ -128,9 +129,10 @@ func (r *RequestRepo) newSecret() (string, error) {
func (r *RequestRepo) sendConfirmationMail(request models.Request) error { func (r *RequestRepo) sendConfirmationMail(request models.Request) error {
var message bytes.Buffer var message bytes.Buffer
var data = struct { var data = struct {
Config config.Config Config config.Config
Request models.Request Request models.Request
}{r.config, request} MessageId template.HTML
}{r.config, request, template.HTML("<" + randomString(15) + "@" + r.config.Server.Domain + ">")}
err := templating.WriteTemplate(&message, "confirmationMail", data) err := templating.WriteTemplate(&message, "confirmationMail", data)
if err != nil { if err != nil {
err = fmt.Errorf("Error parsing confirmation Mail: %w", err) err = fmt.Errorf("Error parsing confirmation Mail: %w", err)

View file

@ -1,6 +1,7 @@
From: {{.Config.Mailer.FromName}} From: {{.Config.Mailer.FromName}}
To: {{.Request.OfficeHour.Tutor.Email}} To: {{.Request.OfficeHour.Tutor.Email}}
Subject: Sprechstunde {{if eq .Request.Action 1}}anlegen{{end}}{{if eq .Request.Action 2}}löschen{{end}} Subject: Sprechstunde {{if eq .Request.Action 1}}anlegen{{end}}{{if eq .Request.Action 2}}löschen{{end}}
Message-Id: {{.MessageId}}
Hallo {{.Request.OfficeHour.Tutor.Name}}, Hallo {{.Request.OfficeHour.Tutor.Name}},