authelia/internal/templates/types.go
James Elliott df016be29e
fix(notification): incorrect date header format (#3684)
* fix(notification): incorrect date header format

The date header in the email envelopes was incorrectly formatted missing a space between the `Date:` header and the value of this header. This also refactors the notification templates system allowing people to manually override the envelope itself.

* test: fix tests and linting issues

* fix: misc issues

* refactor: misc refactoring

* docs: add example for envelope with message id

* refactor: organize smtp notifier

* refactor: move subject interpolation

* refactor: include additional placeholders

* docs: fix missing link

* docs: gravity

* fix: rcpt to command

* refactor: remove mid

* refactor: apply suggestions

Co-authored-by: Amir Zarrinkafsh <nightah@me.com>

* refactor: include pid

Co-authored-by: Amir Zarrinkafsh <nightah@me.com>
2022-07-18 10:56:09 +10:00

74 lines
1.6 KiB
Go

package templates
import (
"text/template"
"time"
)
// Templates is the struct which holds all the *template.Template values.
type Templates struct {
notification NotificationTemplates
}
// NotificationTemplates are the templates for the notification system.
type NotificationTemplates struct {
envelope *template.Template
passwordReset HTMLPlainTextTemplate
identityVerification HTMLPlainTextTemplate
}
// Format of a template.
type Format int
// Formats.
const (
DefaultFormat Format = iota
HTMLFormat
PlainTextFormat
)
// Config for the Provider.
type Config struct {
EmailTemplatesPath string
}
// EmailPasswordResetValues are the values used for password reset templates.
type EmailPasswordResetValues struct {
UUID string
Title string
DisplayName string
RemoteIP string
}
// EmailIdentityVerificationValues are the values used for the identity verification templates.
type EmailIdentityVerificationValues struct {
UUID string
Title string
DisplayName string
RemoteIP string
LinkURL string
LinkText string
}
// EmailEnvelopeValues are the values used for the email envelopes.
type EmailEnvelopeValues struct {
ProcessID int
UUID string
Host string
ServerName string
SenderDomain string
Identifier string
From string
To string
Subject string
Date time.Time
Boundary string
Body EmailEnvelopeBodyValues
}
// EmailEnvelopeBodyValues are the values used for the email envelopes bodies.
type EmailEnvelopeBodyValues struct {
PlainText string
HTML string
}