From 7f930e072f82c62aa5426961dec5b7f9c928edfd Mon Sep 17 00:00:00 2001 From: Josh Smith Date: Sat, 9 Dec 2017 08:12:31 -0500 Subject: [PATCH 1/3] Fix typo in setup instructions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f96e4a7..92e8a0e 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Your credentials will be stored on disk encrypted with a 32-byte random password. When configuring your client, you'll need this password. ```shell -go get github.com/emersion/hydroxide +go get github.com/emersion/hydroxide/cmd/hydroxide hydroxide auth ``` From a7692bcf1fbca36a1e697b2c3eb175da43fdf784 Mon Sep 17 00:00:00 2001 From: Josh Smith Date: Sat, 9 Dec 2017 08:22:54 -0500 Subject: [PATCH 2/3] Added additional setup details --- README.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 92e8a0e..0759b67 100644 --- a/README.md +++ b/README.md @@ -11,16 +11,32 @@ Rationale: * Standard-compliant (we don't care about Microsoft Outlook) * Fully open-source -## Usage +## Setup + +### Golang + +hydroxide is implemented with Go. Head to [Golang website](https://golang.org) +for setup information. + +### Install and Setup + +Install hydroxide + +```shell +go get github.com/emersion/hydroxide/cmd/hydroxide +``` Your credentials will be stored on disk encrypted with a 32-byte random password. When configuring your client, you'll need this password. ```shell -go get github.com/emersion/hydroxide/cmd/hydroxide hydroxide auth ``` +## Usage + +hydroxide can be used in multiple modes. + ### CardDAV You must setup an HTTPS reverse proxy to forward requests to `hydroxide`. From 9569e66ccb6f4754b5e41ad8b7c04ad76edb3d88 Mon Sep 17 00:00:00 2001 From: emersion Date: Tue, 12 Dec 2017 13:46:22 +0100 Subject: [PATCH 3/3] smtp: fix sending message to plaintext and encrypted recipients --- cmd/hydroxide/hydroxide.go | 1 + protonmail/protonmail.go | 7 +++++-- smtp/smtp.go | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/hydroxide/hydroxide.go b/cmd/hydroxide/hydroxide.go index af2d2ac..931a678 100644 --- a/cmd/hydroxide/hydroxide.go +++ b/cmd/hydroxide/hydroxide.go @@ -145,6 +145,7 @@ func main() { s.Addr = "127.0.0.1:" + port s.Domain = "localhost" // TODO: make this configurable s.AllowInsecureAuth = true // TODO: remove this + //s.Debug = os.Stdout log.Println("Starting SMTP server at", s.Addr) log.Fatal(s.ListenAndServe()) diff --git a/protonmail/protonmail.go b/protonmail/protonmail.go index a5a723f..2e17e7c 100644 --- a/protonmail/protonmail.go +++ b/protonmail/protonmail.go @@ -4,6 +4,7 @@ package protonmail import ( "bytes" "encoding/json" + "fmt" "io" "io/ioutil" "net/http" @@ -23,7 +24,8 @@ type resp struct { func (r *resp) Err() error { if err := r.apiError; err != nil { - return r.apiError + err.code = r.Code + return err } return nil } @@ -33,11 +35,12 @@ type maybeError interface { } type apiError struct { + code int // populated by resp Message string `json:"Error"` } func (err apiError) Error() string { - return err.Message + return fmt.Sprintf("[%v] %v", err.code, err.Message) } // Client is a ProtonMail API client. diff --git a/smtp/smtp.go b/smtp/smtp.go index af6a8e2..2db0eac 100644 --- a/smtp/smtp.go +++ b/smtp/smtp.go @@ -237,7 +237,7 @@ func (u *user) Send(from string, to []string, r io.Reader) error { if len(resp.Keys) == 0 { plaintextRecipients = append(plaintextRecipients, rcpt.Address) - break + continue } // TODO: only keys with Send == 1