Return a proper from address
j3s j3s@c3f.net
Fri, 15 Nov 2019 13:05:46 -0600
1 files changed,
7 insertions(+),
2 deletions(-)
jump to
M
main.go
→
main.go
@@ -266,11 +266,16 @@ return false
} func buildCommandEmail(e *email.Email, t bytes.Buffer) *email.Email { + from, err := mail.ParseAddress(e.From) + if err != nil { + log.Printf("WARN: CommandEmail: couldn't parse from address") + } + email := email.NewEmail() email.Sender = gConfig.CommandAddress email.From = "<" + gConfig.CommandAddress + ">" - email.To = []string{e.From} - email.Recipients = []string{e.From} + email.To = []string{from.Name + "<" + from.Address + ">"} + email.Recipients = []string{from.Address} email.Subject = e.Subject email.Text = []byte(t.String()) email.Headers["Date"] = []string{time.Now().Format("Mon, 2 Jan 2006 15:04:05 -0700")}