Add CC header to mail sent after school subscription

This commit is contained in:
Andrea Fazzi 2022-12-07 11:16:16 +01:00
parent d648d88d42
commit 1f9d3606ce
2 changed files with 6 additions and 0 deletions

View file

@ -14,6 +14,7 @@ type Subscriber interface {
Username() string Username() string
Password() string Password() string
To() string To() string
Cc() string
} }
type MailSender struct { type MailSender struct {
@ -39,6 +40,7 @@ func (ms *MailSender) SendSubscriptionMail(rcv Subscriber) error {
m.SetHeader("Subject", ms.config.Smtp.Subject) m.SetHeader("Subject", ms.config.Smtp.Subject)
m.SetHeader("From", ms.config.Smtp.From) m.SetHeader("From", ms.config.Smtp.From)
m.SetHeader("To", rcv.To()) m.SetHeader("To", rcv.To())
m.SetHeader("Cc", rcv.Cc())
m.SetHeader("Bcc", ms.config.Smtp.Bcc) m.SetHeader("Bcc", ms.config.Smtp.Bcc)
err := ms.mailTpl.Execute(&body, rcv) err := ms.mailTpl.Execute(&body, rcv)

View file

@ -102,6 +102,10 @@ func (model *School) To() string {
return model.Email return model.Email
} }
func (model *School) Cc() string {
return model.SchoolContactPersonEmail
}
func (model *School) SetCreatorID(id uint) { func (model *School) SetCreatorID(id uint) {
model.CreatorID = id model.CreatorID = id
} }