diff --git a/docs/notif/mail.md b/docs/notif/mail.md index 4cad6389..539be533 100644 --- a/docs/notif/mail.md +++ b/docs/notif/mail.md @@ -22,6 +22,7 @@ Notifications can be sent through SMTP. | `port`[^1] | `25` | SMTP server port | | `ssl` | `false` | SSL defines whether an SSL connection is used. Should be false in most cases since the auth mechanism should use STARTTLS | | `insecureSkipVerify` | `false` | Controls whether a client verifies the server's certificate chain and hostname | +| `localName` | `localhost` | Hostname sent to the SMTP server with the HELO command | | `username` | | SMTP username | | `usernameFile` | | Use content of secret file as SMTP username if `username` not defined | | `password` | | SMTP password | @@ -34,6 +35,7 @@ Notifications can be sent through SMTP. * `DIUN_NOTIF_MAIL_PORT` * `DIUN_NOTIF_MAIL_SSL` * `DIUN_NOTIF_MAIL_INSECURESKIPVERIFY` + * `DIUN_NOTIF_MAIL_LOCALNAME` * `DIUN_NOTIF_MAIL_USERNAME` * `DIUN_NOTIF_MAIL_USERNAMEFILE` * `DIUN_NOTIF_MAIL_PASSWORD` diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 6c91dbb4..3fa7aa4a 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -75,6 +75,7 @@ func TestLoadFile(t *testing.T) { Port: 25, SSL: utl.NewFalse(), InsecureSkipVerify: utl.NewFalse(), + LocalName: "localhost", From: "diun@example.com", To: "webmaster@example.com", }, @@ -371,6 +372,7 @@ func TestLoadMixed(t *testing.T) { Port: 25, SSL: utl.NewFalse(), InsecureSkipVerify: utl.NewTrue(), + LocalName: "localhost", From: "diun@foo.com", To: "webmaster@foo.com", }, diff --git a/internal/model/notif_mail.go b/internal/model/notif_mail.go index 55acc3af..72e61803 100644 --- a/internal/model/notif_mail.go +++ b/internal/model/notif_mail.go @@ -10,6 +10,7 @@ type NotifMail struct { Port int `yaml:"port,omitempty" json:"port,omitempty" validate:"required,min=1"` SSL *bool `yaml:"ssl,omitempty" json:"ssl,omitempty" validate:"required"` InsecureSkipVerify *bool `yaml:"insecureSkipVerify,omitempty" json:"insecureSkipVerify,omitempty" validate:"required"` + LocalName string `yaml:"localName,omitempty" json:"localName,omitempty" validate:"omitempty"` Username string `yaml:"username,omitempty" json:"username,omitempty" validate:"omitempty"` UsernameFile string `yaml:"usernameFile,omitempty" json:"usernameFile,omitempty" validate:"omitempty,file"` Password string `yaml:"password,omitempty" json:"password,omitempty" validate:"omitempty"` @@ -31,4 +32,5 @@ func (s *NotifMail) SetDefaults() { s.Port = 25 s.SSL = utl.NewFalse() s.InsecureSkipVerify = utl.NewFalse() + s.LocalName = "localhost" }