summaryrefslogtreecommitdiff
path: root/app/email.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/email.go')
-rw-r--r--app/email.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/email.go b/app/email.go
index b497bf7..c92fed0 100644
--- a/app/email.go
+++ b/app/email.go
@@ -8,7 +8,7 @@ import (
"os"
)
-func SendEmail(u []User, h []Host) {
+func SendEmail(u []User, h []Host, name string) {
log.Println("Sending E-Mail")
if len(u) == 0 {
return
@@ -18,11 +18,11 @@ func SendEmail(u []User, h []Host) {
}
log.Println("Sending E-Mail - Checked")
adresses := getEmails(u)
- h = getHosts(h)
+ //h = getHosts(h)
e := &email.Email{
To: adresses,
From: "StatusPage <" + os.Getenv("STATUS_HTTP_ADRESS") + ">",
- Subject: "Host is down (" + h[0].Host + ")",
+ Subject: "Host is down (" + name + ")",
HTML: getBody(h),
}
err := e.Send(os.Getenv("STATUS_HTTP_MAILER"), smtp.PlainAuth("", os.Getenv("STATUS_HTTP_ADRESS"), os.Getenv("STATUS_HTTP_PASSWORD"), os.Getenv("STATUS_HTTP_MAILER")))
@@ -40,7 +40,7 @@ func getEmails(u []User) []string {
func getHosts(hosts []Host) []Host {
var h []Host
for k, _ := range hosts {
- if !hosts[k].Monitored {
+ if hosts[k].Class == "danger" {
h = append(h, hosts[k])
}
}