From 1dfadda07e59ffbf0205d8122240743327b6af0a Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Mon, 31 Oct 2022 22:22:02 +1300 Subject: [PATCH 1/8] Use path.Join() instead of url.JoinPath() for < 1.19 compatibility --- config/config.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/config/config.go b/config/config.go index 639b2ec72..cc5d84a4b 100644 --- a/config/config.go +++ b/config/config.go @@ -3,8 +3,8 @@ package config import ( "errors" "fmt" - "net/url" "os" + "path" "path/filepath" "regexp" "strings" @@ -148,10 +148,7 @@ func VerifyConfig() error { return fmt.Errorf("Webroot cannot contain spaces (%s)", Webroot) } - s, err := url.JoinPath("/", Webroot, "/") - if err != nil { - return err - } + s := path.Join("/", Webroot, "/") Webroot = s return nil From 376e799eb06bc8b21da7f715f1b0c022ab6deac2 Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Tue, 1 Nov 2022 20:24:28 +1300 Subject: [PATCH 2/8] Update README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f03a1ec33..602f1de60 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Mailpit is inspired by [MailHog](#why-rewrite-mailhog), but much, much faster. - Optional SMTP with STARTTLS & SMTP authentication ([see wiki](https://github.com/axllent/mailpit/wiki/SMTP-with-STARTTLS-and-authentication)) - Optional HTTPS for web UI ([see wiki](https://github.com/axllent/mailpit/wiki/HTTPS)) - Optional basic authentication for web UI ([see wiki](https://github.com/axllent/mailpit/wiki/Basic-authentication)) -- A simple REST API allowing ([see docs](docs/apiv1/README.md)) +- A simple REST API ([see docs](docs/apiv1/README.md)) - Multi-architecture [Docker images](https://github.com/axllent/mailpit/wiki/Docker-images) @@ -42,7 +42,7 @@ Linux & Mac users can install it directly to `/usr/local/bin/mailpit` with: sudo bash < <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh) ``` -Or download a pre-built binary in the [releases](https://github.com/axllent/mailpit/releases/latest). The `mailpit` can be placed in your `$PATH`, or simply run as `./mailpit`. See `mailpit -h` for options, or see [the wiki](https://github.com/axllent/mailpit/wiki/Runtime-options) for additional information. +Or download a static binary from the [releases](https://github.com/axllent/mailpit/releases/latest). The `mailpit` binary can be placed in your `$PATH`, or simply run as `./mailpit`. See `mailpit -h` for options, or see [the wiki](https://github.com/axllent/mailpit/wiki/Runtime-options) for additional information. To build Mailpit from source see [building from source](https://github.com/axllent/mailpit/wiki/Building-from-source). From ba24d145ffcbf8920889f27d85087b3498c0df4e Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Sun, 6 Nov 2022 12:32:03 +1300 Subject: [PATCH 3/8] Bugfix: Return empty arrays rather than null for message To, CC, BCC, Inlines & Attachments Bugfix: Return empty arrays rather than null for message To, CC, BCC, Inlines & Attachments --- docs/apiv1/Message.md | 6 +++--- docs/apiv1/Messages.md | 4 ++-- docs/apiv1/Search.md | 4 ++-- server/ui-src/templates/Message.vue | 26 ++++++++++++-------------- storage/database.go | 2 ++ storage/utils.go | 5 ++++- 6 files changed, 25 insertions(+), 22 deletions(-) diff --git a/docs/apiv1/Message.md b/docs/apiv1/Message.md index ff0a74f4e..5cf47b5b6 100644 --- a/docs/apiv1/Message.md +++ b/docs/apiv1/Message.md @@ -26,8 +26,8 @@ Returns a JSON summary of the message and attachments. "Address": "jane@example.com" } ], - "Cc": null, - "Bcc": null, + "Cc": [], + "Bcc": [], "Subject": "Message subject", "Date": "2016-09-07T16:46:00+13:00", "Text": "Plain text MIME part of the email", @@ -57,7 +57,7 @@ Returns a JSON summary of the message and attachments. - `Read` - always true (message marked read on open) - `From` - Name & Address, or null -- `To`, `CC`, `BCC` - Array of Names & Address, or null +- `To`, `CC`, `BCC` - Array of Names & Address - `Date` - Parsed email local date & time from headers - `Size` - Total size of raw email - `Inline`, `Attachments` - Array of attachments and inline images. diff --git a/docs/apiv1/Messages.md b/docs/apiv1/Messages.md index a4d5aea49..9d721294e 100644 --- a/docs/apiv1/Messages.md +++ b/docs/apiv1/Messages.md @@ -51,7 +51,7 @@ List messages in the mailbox. Messages are returned in the order of latest recei "Address": "accounts@example.com" } ], - "Bcc": null, + "Bcc": [], "Subject": "Message subject", "Created": "2022-10-03T21:35:32.228605299+13:00", "Size": 6144, @@ -70,7 +70,7 @@ List messages in the mailbox. Messages are returned in the order of latest recei - `start` - The offset (default `0`) for pagination - `Read` - The read/unread status of the message - `From` - Name & Address, or null if none -- `To`, `CC`, `BCC` - Array of Names & Address, or null if none +- `To`, `CC`, `BCC` - Array of Names & Address - `Created` - Local date & time the message was received - `Size` - Total size of raw email in bytes diff --git a/docs/apiv1/Search.md b/docs/apiv1/Search.md index f2c7aa2ec..fdf6d021b 100644 --- a/docs/apiv1/Search.md +++ b/docs/apiv1/Search.md @@ -47,7 +47,7 @@ Matching messages are returned in the order of latest received to oldest. "Address": "accounts@example.com" } ], - "Bcc": null, + "Bcc": [], "Subject": "Test email", "Created": "2022-10-03T21:35:32.228605299+13:00", "Size": 6144, @@ -65,5 +65,5 @@ Matching messages are returned in the order of latest received to oldest. - `count` - Number of messages returned in request - `start` - The offset (default `0`) for pagination - `From` - Singular Name & Address, or null if none -- `To`, `CC`, `BCC` - Array of Name & Address, or null if none +- `To`, `CC`, `BCC` - Array of Name & Address - `Size` - Total size of raw email in bytes diff --git a/server/ui-src/templates/Message.vue b/server/ui-src/templates/Message.vue index 403151a99..c4a86e885 100644 --- a/server/ui-src/templates/Message.vue +++ b/server/ui-src/templates/Message.vue @@ -128,29 +128,27 @@ export default { To - + - {{ t.Name + " <" + t.Address +">" }} - - Undisclosed recipients + {{ t.Name + " <" + t.Address + ">" }} + + Undisclosed recipients - + CC - {{ t.Name + " <" + t.Address +">" }} - + {{ t.Name + " <" + t.Address + ">" }} - - CC + + BCC - {{ t.Name + " <" + t.Address +">" }} - + {{ t.Name + " <" + t.Address + ">" }} @@ -174,7 +172,7 @@ export default {