This is the main dovel repository, it has the Go code to run dovel SMTP server.
Author: x (x@mail.blmayer.dev)
Date: Tue Jun 20 00:02:10 2023 -0300
Parent: a9e3721
Added message decryption
commit 26d71c948c68d6f9ea4f5b8c13876babc256ae4c Author: x <x@mail.blmayer.dev> Date: Tue Jun 20 00:02:10 2023 -0300 Added message decryption diff --git a/interfaces/file/file.go b/interfaces/file/file.go index 556489e..8ff1ad1 100644 --- a/interfaces/file/file.go +++ b/interfaces/file/file.go @@ -29,6 +29,7 @@ import ( "github.com/emersion/go-msgauth/dkim" "github.com/ProtonMail/gopenpgp/v2/helper" + pgp "github.com/ProtonMail/gopenpgp/v2/crypto" ) // FileHandler is used to configure the file email handler. @@ -301,6 +302,13 @@ func (f FileHandler) Mail(file string) (interfaces.Email, error) { return interfaces.Email{}, err } + // try to decrypt + if f.PrivateKey != nil && pgp.IsPGPMessage(email.Body) { + txt, err := helper.DecryptMessageArmored(f.PrivateKey, "", email.Body) + if err != nil { + println(err) + } + } return interfaces.ToEmail(mail), nil }