Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion outputs/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"net"
"strconv"
"strings"
"time"

"github.com/aquasecurity/postee/v2/data"
"github.com/aquasecurity/postee/v2/formatting"
Expand Down Expand Up @@ -153,12 +154,14 @@ func (email *EmailOutput) Send(content map[string]string) (data.OutputResponse,
return email.sendViaAwsSesService(email.AwsSesConfig, subject, body, recipients)
}

date := time.Now().Format(time.RFC1123Z)
msg := fmt.Sprintf(
"To: %s\r\n"+
"From: %s\r\n"+
"Subject: %s\r\n"+
"Date: %s\r\n"+
"Content-Type: text/html; charset=UTF-8\r\n\r\n%s\r\n",
strings.Join(recipients, ","), email.Sender, subject, body)
strings.Join(recipients, ","), email.Sender, subject, date, body)

if email.UseMX {
email.sendViaMxServers(port, msg, recipients)
Expand Down
8 changes: 6 additions & 2 deletions outputs/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ func getHandledRecipients(recipients []string, content *map[string]string, outpu
log.Logger.Errorf("get application scope owners error for %q: %v", outputName, err)
continue
}
result = append(result, owners...)
} else {
for _, owner := range owners {
if owner != "" {
result = append(result, owner)
}
}
} else if r != "" {
result = append(result, r)
}
}
Expand Down
7 changes: 6 additions & 1 deletion router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,12 @@ func (ctx *Router) publish(msg map[string]interface{}, r *routes.InputRoute) []d

for _, name := range r.Outputs {
go func(svc service, outputName string, in map[string]interface{}, route *routes.InputRoute) {
defer wg.Done()
defer func() {
if r := recover(); r != nil {
log.Logger.Errorf("Panic in output %s: %v", outputName, r)
}
wg.Done()
}()

ticket, err := ctx.publishOutput(svc, outputName, in, route)
if err != nil {
Expand Down
Loading