diff options
| author | Paul Buetow <paul@buetow.org> | 2023-06-07 09:31:35 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-06-07 09:31:35 +0300 |
| commit | faf8b0f8715a280c7f7f98595042fd4897e8da0b (patch) | |
| tree | b4fbe2d477b7f0f1b95bfe3afbcb852a007f9e49 /internal/notify.go | |
| parent | 9ecc857cf39c8d110da9a0c99830d2a0d15efed8 (diff) | |
restyle
Diffstat (limited to 'internal/notify.go')
| -rw-r--r-- | internal/notify.go | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/internal/notify.go b/internal/notify.go index 7d8fc5a..991743d 100644 --- a/internal/notify.go +++ b/internal/notify.go @@ -6,15 +6,16 @@ import ( "net/smtp" ) -func notify(config config, subject, body string) error { +func notify(conf config, subject, body string) error { log.Println("notify", subject, body) - headers := make(map[string]string) - headers["From"] = config.EmailFrom - headers["To"] = config.EmailTo - headers["Subject"] = subject - headers["MIME-Version"] = "1.0" - headers["Content-Type"] = "text/plain; charset=\"utf-8\"" + headers := map[string]string{ + "From": conf.EmailFrom, + "To": conf.EmailTo, + "Subject": subject, + "MIME-Version": "1.0", + "Content-Type": "text/plain; charset=\"utf-8\"", + } header := "" for k, v := range headers { @@ -22,12 +23,12 @@ func notify(config config, subject, body string) error { } message := header + "\r\n" + body - log.Println("Using SMTP server", config.SMTPServer) + log.Println("Using SMTP server", conf.SMTPServer) - return smtp.SendMail(config.SMTPServer, nil, config.EmailFrom, - []string{config.EmailTo}, []byte(message)) + return smtp.SendMail(conf.SMTPServer, nil, conf.EmailFrom, + []string{conf.EmailTo}, []byte(message)) } -func notifyError(config config, err error) error { - return notify(config, fmt.Sprintf("GOGIOS: An error occured: %v", err), err.Error()) +func notifyError(conf config, err error) error { + return notify(conf, fmt.Sprintf("GOGIOS: An error occured: %v", err), err.Error()) } |
