Skip to content

Commit

Permalink
fix SMTP output duplicate headers
Browse files Browse the repository at this point in the history
Signed-off-by: Edgaras <[email protected]>
  • Loading branch information
apsega committed Jun 21, 2023
1 parent 8de9c35 commit 9a36f5e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions outputs/smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ func (c *Client) SendMail(falcopayload types.FalcoPayload) {
smtpClient.Auth(auth)
}

body := sp.To + "\n" + sp.Subject + "\n" + sp.From + "\n" + sp.Body

if c.Config.Debug {
log.Printf("[DEBUG] : SMTP payload : \nServer: %v\n%v\n%v\nSubject: %v\n", c.Config.SMTP.HostPort, sp.From, sp.To, sp.Subject)
if c.Config.SMTP.AuthMechanism != "" {
Expand All @@ -166,7 +164,7 @@ func (c *Client) SendMail(falcopayload types.FalcoPayload) {
}

c.Stats.SMTP.Add("total", 1)
err = smtpClient.SendMail(c.Config.SMTP.From, to, strings.NewReader(body))
err = smtpClient.SendMail(c.Config.SMTP.From, to, strings.NewReader(sp.Body))
if err != nil {
c.ReportErr("Send Mail failure", err)
return
Expand Down

0 comments on commit 9a36f5e

Please sign in to comment.