Enable commandEmail list function
j3s j3s@c3f.net
Fri, 15 Nov 2019 12:52:45 -0600
2 files changed,
10 insertions(+),
10 deletions(-)
M
main.go
→
main.go
@@ -196,14 +196,9 @@ "\r\nTo subscribe to a mailing list, email %s with 'subscribe <list-id>' as the subject.\r\n",
gConfig.CommandAddress) log.Printf("SEND") - reply := reply(msg) - log.Printf("SEND") - reply.From = gConfig.CommandAddress - log.Printf("SEND") - reply.Text = []byte(body.String()) - log.Printf("SEND") - send(reply) - log.Printf("LIST_SENT To=%q", reply.To) + email := buildCommandEmail(msg, body) + send(email) + log.Printf("LIST_SENT To=%q", msg.From) } // Handle a subscribe command@@ -270,14 +265,14 @@ }
return false } -func buildCommandEmail(e *email.Email, t string) *email.Email { +func buildCommandEmail(e *email.Email, t bytes.Buffer) *email.Email { email := email.NewEmail() email.Sender = gConfig.CommandAddress email.From = "<" + gConfig.CommandAddress + ">" email.To = []string{e.From} email.Recipients = []string{e.From} email.Subject = e.Subject - email.Text = []byte(t) + email.Text = []byte(t.String()) email.Headers["Date"] = []string{time.Now().Format("Mon, 2 Jan 2006 15:04:05 -0700")} email.Headers["Precedence"] = []string{"list"} email.Headers["List-Help"] = []string{"<mailto:" + gConfig.CommandAddress + "?subject=help>"}
A
scripts/quickdeploy
@@ -0,0 +1,5 @@
+#!/bin/sh -eu + +rm -f clist +go build . +mv clist /usr/local/bin/clist