all repos — mdawh @ 2f01a226cb575ccf8711b053399fa05df8023a73

An MDA that creates a webhook on recieval of mail

Add Reply-To header
Anirudh Oppiliappan x@icyphox.sh
Fri, 02 Apr 2021 21:55:43 +0530
commit

2f01a226cb575ccf8711b053399fa05df8023a73

parent

4174dd7f66d2601de15696f3c70776c6b2462b35

1 files changed, 7 insertions(+), 4 deletions(-)

jump to
M main.gomain.go

@@ -9,6 +9,7 @@ "io/ioutil"

"log" "net/http" "os" + "strings" "github.com/emersion/go-message/mail" )

@@ -16,9 +17,10 @@

type P map[string]string type Mail struct { - From string - Date string - Parts []P + From string + Date string + ReplyTo string + Parts []P } func makeReq(j []byte) {

@@ -39,6 +41,7 @@

newmail := Mail{} newmail.Date = mr.Header.Get("Date") newmail.From = mr.Header.Get("From") + newmail.ReplyTo = mr.Header.Get("Reply-To") if err != nil { log.Fatal(err)

@@ -53,7 +56,7 @@ log.Fatal(err)

} switch h := p.Header.(type) { case *mail.InlineHeader: - ct := p.Header.Get("Content-Type") + ct := strings.Split(p.Header.Get("Content-Type"), ";")[0] b, _ := ioutil.ReadAll(p.Body) part := P{ct: string(b)} newmail.Parts = append(newmail.Parts, part)