list

server

This is the main dovel repository, it has the Go code to run dovel SMTP server.

curl -O https://dovel.email/server.tar.gz tar.gz

6982a51

Author: myr (brian@myr.sh)

Date: Tue Jul 2 01:20:21 2024 -0300

Parent: 150bb62

Updated x flag

Improved logging

Diff

Dockerfile

diff --git a/Dockerfile b/Dockerfile
old mode 100755
new mode 100644

LICENSE

diff --git a/LICENSE b/LICENSE
old mode 100755
new mode 100644

README.md

diff --git a/README.md b/README.md
old mode 100755
new mode 100644

TODO.txt

diff --git a/TODO.txt b/TODO.txt
old mode 100755
new mode 100644

backend.go

diff --git a/backend.go b/backend.go
old mode 100755
new mode 100644
index a9c4d4a..e813f8a
--- a/backend.go
+++ b/backend.go
@@ -179,7 +179,7 @@ func (s *Session) Send(from string, tos []*mail.Address, raw io.Reader) error {
 		if key != nil {
 			slog.Info("found WKD key", "address", to.Address)
 			enc := bytes.Buffer{}
-			c, err := openpgp.Encrypt(&enc, key, key[0], nil, nil)
+			c, err := openpgp.Encrypt(&enc, key, nil, nil, nil)
 			if err != nil {
 				return err
 			}
@@ -187,6 +187,7 @@ func (s *Session) Send(from string, tos []*mail.Address, raw io.Reader) error {
 			c.Close()
 			email.Header["Content-Type"] = []string{"application/pgp-encrypted"}
 			body = enc.Bytes()
+			slog.Debug("message encrypted", "content", body)
 		}
 
 		// write email headers into payload
@@ -225,6 +226,7 @@ func (s *Session) Send(from string, tos []*mail.Address, raw io.Reader) error {
 			if err != nil {
 				slog.Error("failed to sign body", "err", err)
 			}
+			slog.Debug("signed")
 		} else {
 			slog.Info("no dkim key")
 			io.Copy(&res, bytes.NewReader(body))
@@ -236,13 +238,15 @@ func (s *Session) Send(from string, tos []*mail.Address, raw io.Reader) error {
 		}
 
 		server := mxs[0].Host + ":smtp"
+		content = res.Bytes()
 		slog.Info("sending", "host", server, "from", from, "to", tos)
+		slog.Debug("message", "data", content)
 		err = smtp.SendMail(
 			server,
 			nil,
 			from,
 			addrs,
-			&res,
+			strings.NewReader(string(content)),
 		)
 		if err != nil {
 			return err

doc.go

diff --git a/doc.go b/doc.go
old mode 100755
new mode 100644

go.mod

diff --git a/go.mod b/go.mod
old mode 100755
new mode 100644

go.sum

diff --git a/go.sum b/go.sum
old mode 100755
new mode 100644

main.go

diff --git a/main.go b/main.go
old mode 100755
new mode 100644

model.go

diff --git a/model.go b/model.go
old mode 100755
new mode 100644