This is the main dovel repository, it has the Go code to run dovel SMTP server.
Author: blmayer (bleemayer@gmail.com)
Date: Sat May 6 18:28:43 2023 -0300
Parent: ef096c7
Improved attachments
commit cdc93e6a3ae2d69424848089618a74ad5d8e5de2 Author: blmayer <bleemayer@gmail.com> Date: Sat May 6 18:28:43 2023 -0300 Improved attachments diff --git a/cmd/dovel/web.go b/cmd/dovel/web.go index d7bb4b7..3db1fed 100644 --- a/cmd/dovel/web.go +++ b/cmd/dovel/web.go @@ -80,7 +80,7 @@ func (h webHandler) sendHandler() http.HandlerFunc { Attachments: map[string]interfaces.Attachment{}, } - for name, fi := range fo.File { + for _, fi := range fo.File { attach, err := fi[0].Open() if err != nil { println("error getting attachment: " + err.Error()) @@ -93,10 +93,10 @@ func (h webHandler) sendHandler() http.HandlerFunc { println("error getting attachment: " + err.Error()) continue } - email.Attachments[name] = interfaces.Attachment{ - Name: name, - Data: content, - // TODO: Add content-type + email.Attachments[fi[0].Filename] = interfaces.Attachment{ + Name: fi[0].Filename, + Data: content, + ContentType: fi[0].Header.Get("Content-Type"), } }
commit cdc93e6a3ae2d69424848089618a74ad5d8e5de2 Author: blmayer <bleemayer@gmail.com> Date: Sat May 6 18:28:43 2023 -0300 Improved attachments diff --git a/interfaces/file/file.go b/interfaces/file/file.go index 858b628..cbbf502 100644 --- a/interfaces/file/file.go +++ b/interfaces/file/file.go @@ -69,7 +69,6 @@ func NewFileHandler(c config.InboxConfig, v interfaces.Vault, fs map[string]any) return f, err } - func (f FileHandler) Save(email interfaces.Email) error { mailDir := path.Join(f.root, email.To[0], email.Subject) os.MkdirAll(mailDir, os.ModeDir|0o700)