This is the main dovel repository, it has the Go code to run dovel SMTP server.
Author: b (git@mail.blmayer.dev)
Date: Tue Jul 18 00:05:42 2023 -0300
Parent: 1dc8f91
Fixed web handler
commit 66c46aa5ef2f048d8d9412f2ab1180370ada052b Author: b <git@mail.blmayer.dev> Date: Tue Jul 18 00:05:42 2023 -0300 Fixed web handler diff --git a/cmd/dovel/web.go b/cmd/dovel/web.go index cc21460..9ffb278 100644 --- a/cmd/dovel/web.go +++ b/cmd/dovel/web.go @@ -1,7 +1,6 @@ package main import ( - "crypto" "html/template" "io" "net/http" @@ -124,12 +123,12 @@ func (h webHandler) sendHandler() http.HandlerFunc { fo := r.MultipartForm email := interfaces.Email{ - From: fo.Get("from"), + From: fo.Value["from"][0], To: fo.Value["to"], Cc: fo.Value["cc"], - Subject: fo.Get("subject"), + Subject: fo.Value["subject"][0], Date: time.Now(), - Body: fo.Get("body"), + Body: fo.Value["body"][0], Attachments: map[string]interfaces.Attachment{}, } @@ -154,8 +153,10 @@ func (h webHandler) sendHandler() http.HandlerFunc { } opts := interfaces.Opt{ - Key: fo.Get("key"), - Encrypt: fo.Get("encrypt") != "", + Encrypt: len(fo.Value["encrypt"]) > 0, + } + if len(fo.Value["key"]) > 0 { + opts.Key = fo.Value["key"][0] } err := h.mailer.Send(email, opts) if err != nil {