Fixed and improved logging of sent mail notifications
This commit is contained in:
parent
905eb32c90
commit
2af8122753
1 changed files with 4 additions and 2 deletions
6
main.go
6
main.go
|
@ -79,15 +79,17 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(newNotices) > 0 {
|
if len(newNotices) > 0 {
|
||||||
for _, r := range config.Recipients {
|
|
||||||
fmt.Printf("INFO\t%v Sending email notifications ...\n", time.Now().Format(time.RFC3339Nano))
|
fmt.Printf("INFO\t%v Sending email notifications ...\n", time.Now().Format(time.RFC3339Nano))
|
||||||
|
recipientsNotified := 0
|
||||||
|
for _, r := range config.Recipients {
|
||||||
err := r.filterAndSendNotices(newNotices, mailTemplate, mailAuth, config.SmtpConfiguration)
|
err := r.filterAndSendNotices(newNotices, mailTemplate, mailAuth, config.SmtpConfiguration)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("ERROR\t%v\n", err)
|
fmt.Printf("ERROR\t%v\n", err)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("INFO\t%v Email notifications sent.\n", time.Now().Format(time.RFC3339Nano))
|
recipientsNotified++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fmt.Printf("INFO\t%v Email notifications sent to %v of %v recipients.\n", time.Now().Format(time.RFC3339Nano), recipientsNotified, len(config.Recipients))
|
||||||
}
|
}
|
||||||
t2 := time.Now().UnixMilli()
|
t2 := time.Now().UnixMilli()
|
||||||
dt := int(t2 - t1)
|
dt := int(t2 - t1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue