From 3586abab1cbf05cac447cfa4609373404f5cf7ea Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Fri, 20 Oct 2023 23:49:23 +1300 Subject: [PATCH 01/11] Reduce time limit for stale issues to 14 days --- .github/workflows/close-stale-issues.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/close-stale-issues.yml b/.github/workflows/close-stale-issues.yml index d5bcb05ca..f3b0b6e9f 100644 --- a/.github/workflows/close-stale-issues.yml +++ b/.github/workflows/close-stale-issues.yml @@ -12,11 +12,11 @@ jobs: steps: - uses: actions/stale@v8.0.0 with: - days-before-issue-stale: 21 + days-before-issue-stale: 14 days-before-issue-close: 7 exempt-issue-labels: "enhancement,bug,javascript,docker" stale-issue-label: "stale" - stale-issue-message: "This issue is stale because it has been open for 21 days with no activity." + stale-issue-message: "This issue is stale because it has been open for 14 days with no activity." close-issue-message: "This issue was closed because it has been inactive for 7 days since being marked as stale." days-before-pr-stale: -1 days-before-pr-close: -1 From 2efa206c4fb6322327337d086c81b248e1b0a1e9 Mon Sep 17 00:00:00 2001 From: Alexander Ofori Date: Sun, 22 Oct 2023 08:56:12 +0100 Subject: [PATCH 02/11] Correction to brew automatic start sentence (#196) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 01201c127..15eac5747 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ To build Mailpit from source see [building from source](https://github.com/axlle Run `mailpit -h` to see options. More information can be seen in [the docs](https://github.com/axllent/mailpit/wiki/Runtime-options). -If installed using homebrew, you may run `brew services start mailpit` to run always run mailpit automatically. +If installed using homebrew, you may run `brew services start mailpit` to always run mailpit automatically. ### Testing Mailpit From 8f5ef400d8a515fd1fabba381bc8f87e108987f7 Mon Sep 17 00:00:00 2001 From: Alexander Ofori Date: Mon, 23 Oct 2023 10:44:30 +0100 Subject: [PATCH 03/11] Correction to Usage, Testing Mail and Configuring Mail (#197) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 15eac5747..b496ded0f 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ sudo bash < <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop ### Download static binary (Windows, Linux and Mac) -Static binaries can always be found on the [releases](https://github.com/axllent/mailpit/releases/latest). The `mailpit` binary can extracted and copied to your `$PATH`, or simply run as `./mailpit`. +Static binaries can always be found on the [releases](https://github.com/axllent/mailpit/releases/latest). The `mailpit` binary can be extracted and copied to your `$PATH`, or simply run as `./mailpit`. ### Docker @@ -88,9 +88,9 @@ If installed using homebrew, you may run `brew services start mailpit` to always ### Testing Mailpit -Please refer to [the documentation](https://github.com/axllent/mailpit/wiki/Testing-Mailpit) of how to easily test email delivery to Mailpit. +Please refer to [the documentation](https://github.com/axllent/mailpit/wiki/Testing-Mailpit) on how to easily test email delivery to Mailpit. ### Configuring sendmail -Mailpit's SMTP server (by default on port 1025), so you will likely need to configure your sending application to deliver mail via that port. A common MTA (Mail Transfer Agent) that delivers system emails to a SMTP server is `sendmail`, used by many applications including PHP. Mailpit can also act as substitute for sendmail. For instructions of how to set this up, please refer to the [sendmail documentation](https://github.com/axllent/mailpit/wiki/Configuring-sendmail). +Mailpit's SMTP server (by default on port 1025), so you will likely need to configure your sending application to deliver mail via that port. A common MTA (Mail Transfer Agent) that delivers system emails to an SMTP server is `sendmail`, used by many applications including PHP. Mailpit can also act as substitute for sendmail. For instructions of how to set this up, please refer to the [sendmail documentation](https://github.com/axllent/mailpit/wiki/Configuring-sendmail). From 615db61df38f801597d427c184dd4e3e289bdaaf Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Tue, 24 Oct 2023 00:35:00 +1300 Subject: [PATCH 04/11] Grammar changes --- README.md | 18 +++++++++--------- docs/apiv1/README.md | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b496ded0f..afd74d4ff 100644 --- a/README.md +++ b/README.md @@ -10,21 +10,21 @@ Mailpit is a small, fast, low memory, zero-dependency, multi-platform email test It acts as an SMTP server, provides a modern web interface to view & test captured emails, and contains an API for automated integration testing. -Mailpit was originally **inspired** by MailHog which is now [no longer maintained](https://github.com/mailhog/MailHog/issues/442#issuecomment-1493415258) and hasn't seen active development for a few years now. +Mailpit was originally **inspired** by MailHog which is [no longer maintained](https://github.com/mailhog/MailHog/issues/442#issuecomment-1493415258) and hasn't seen active development for a few years now. ![Mailpit](https://raw.githubusercontent.com/axllent/mailpit/develop/docs/screenshot.png) ## Features -- Runs entirely from a single binary, no installation required -- SMTP server (default `0.0.0.0:1025`) -- Web UI to view emails (formatted HTML, highlighted HTML source, text, headers, raw source and MIME attachments including image thumbnails) +- Runs entirely from a single static binary +- SMTP server (default: `0.0.0.0:1025`) +- Web UI to view emails (formatted HTML, highlighted HTML source, text, headers, raw source, and MIME attachments including image thumbnails) - HTML check to test & score mail client compatibility with HTML emails - Link check to test message links (HTML & text) & linked images - Screenshots of HTML messages via web UI ([see wiki](https://github.com/axllent/mailpit/wiki/HTML-screenshots)) - Mobile and tablet HTML preview toggle in desktop mode -- Light & dark web UI theme with auto-detect +- Light & dark web UI themes with auto-detect - Advanced mail search ([see wiki](https://github.com/axllent/mailpit/wiki/Mail-search)) - Message tagging ([see wiki](https://github.com/axllent/mailpit/wiki/Tagging)) - Real-time web UI updates using web sockets for new mail @@ -43,14 +43,14 @@ Mailpit was originally **inspired** by MailHog which is now [no longer maintaine ## Installation -The Mailpit web UI listens by default on `http://0.0.0.0:8025`, and the SMTP port on `0.0.0.0:1025`. +The Mailpit web UI listens by default on `http://0.0.0.0:8025` and the SMTP port on `0.0.0.0:1025`. Mailpit runs as a single binary and can be installed in different ways: ### Install via package managers -- **Mac**: `brew install mailpit` (to run automatically in background `brew services start mailpit`) +- **Mac**: `brew install mailpit` (to run automatically in the background: `brew services start mailpit`) - **Arch Linux**: available in the AUR as `mailpit` - **FreeBSD**: `pkg install mailpit` @@ -76,7 +76,7 @@ See [Docker instructions](https://github.com/axllent/mailpit/wiki/Docker-images) ### Compile from source -To build Mailpit from source see [building from source](https://github.com/axllent/mailpit/wiki/Building-from-source). +To build Mailpit from source, see [Building from source](https://github.com/axllent/mailpit/wiki/Building-from-source). ## Usage @@ -93,4 +93,4 @@ Please refer to [the documentation](https://github.com/axllent/mailpit/wiki/Test ### Configuring sendmail -Mailpit's SMTP server (by default on port 1025), so you will likely need to configure your sending application to deliver mail via that port. A common MTA (Mail Transfer Agent) that delivers system emails to an SMTP server is `sendmail`, used by many applications including PHP. Mailpit can also act as substitute for sendmail. For instructions of how to set this up, please refer to the [sendmail documentation](https://github.com/axllent/mailpit/wiki/Configuring-sendmail). +Mailpit's SMTP server (default on port 1025), so you will likely need to configure your sending application to deliver mail via that port. A common MTA (Mail Transfer Agent) that delivers system emails to an SMTP server is `sendmail`, used by many applications, including PHP. Mailpit can also act as substitute for sendmail. For instructions on how to set this up, please refer to the [sendmail documentation](https://github.com/axllent/mailpit/wiki/Configuring-sendmail). diff --git a/docs/apiv1/README.md b/docs/apiv1/README.md index 54b34a3da..682f52388 100644 --- a/docs/apiv1/README.md +++ b/docs/apiv1/README.md @@ -6,7 +6,7 @@ If the Mailpit server is set to use Basic Authentication, then API requests must You can view the Swagger API documentation directly within Mailpit by going to `http://0.0.0.0:8025/api/v1/`. -The API is split into three main parts: +The API is split into four main parts: - [Messages](Messages.md) - Listing, deleting & marking messages as read/unread. - [Message](Message.md) - Return message data & attachments From d82b1e731c538a99499e17e48285f5d865a2e7ed Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Tue, 24 Oct 2023 09:00:45 +1300 Subject: [PATCH 05/11] UI: Fix column width in search view --- server/ui-src/views/SearchView.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/ui-src/views/SearchView.vue b/server/ui-src/views/SearchView.vue index b86e5bcde..797d9c08e 100644 --- a/server/ui-src/views/SearchView.vue +++ b/server/ui-src/views/SearchView.vue @@ -102,14 +102,14 @@ export default {
-
-
+
From f29016a1750018c5846a46dfda8dc4d2b8d806e6 Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Wed, 25 Oct 2023 10:01:03 +1300 Subject: [PATCH 06/11] Docs: Update documentation links --- README.md | 52 ++++++++++++----------- cmd/reindex.go | 4 -- cmd/root.go | 2 +- docs/apiv1/README.md | 2 +- server/ui-src/components/AboutMailpit.vue | 3 +- 5 files changed, 30 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index afd74d4ff..3a5afa68c 100644 --- a/README.md +++ b/README.md @@ -17,28 +17,28 @@ Mailpit was originally **inspired** by MailHog which is [no longer maintained](h ## Features -- Runs entirely from a single static binary -- SMTP server (default: `0.0.0.0:1025`) -- Web UI to view emails (formatted HTML, highlighted HTML source, text, headers, raw source, and MIME attachments including image thumbnails) -- HTML check to test & score mail client compatibility with HTML emails -- Link check to test message links (HTML & text) & linked images -- Screenshots of HTML messages via web UI ([see wiki](https://github.com/axllent/mailpit/wiki/HTML-screenshots)) +- Runs entirely from a single [static binary](https://mailpit.axllent.org/docs/install/) +- Modern web UI to view emails (formatted HTML, highlighted HTML source, text, headers, raw source, and MIME attachments +including image thumbnails), including optional [HTTPS](https://mailpit.axllent.org/docs/configuration/https/) +- Optional [basic authentication](https://mailpit.axllent.org/docs/configuration/frontend-authentication/) for web UI & API +- [HTML check](https://mailpit.axllent.org/docs/usage/html-check/) to test & score mail client compatibility with HTML emails +- [Link check](https://mailpit.axllent.org/docs/usage/link-check/) to test message links (HTML & text) & linked images +- [Create screenshots](https://mailpit.axllent.org/docs/usage/html-screenshots/) of HTML messages via web UI - Mobile and tablet HTML preview toggle in desktop mode -- Light & dark web UI themes with auto-detect -- Advanced mail search ([see wiki](https://github.com/axllent/mailpit/wiki/Mail-search)) -- Message tagging ([see wiki](https://github.com/axllent/mailpit/wiki/Tagging)) -- Real-time web UI updates using web sockets for new mail -- Optional browser notifications for new mail (when accessed via either HTTPS or `localhost` only) +- Advanced [mail search](https://mailpit.axllent.org/docs/usage/search-filters/) +- [Message tagging](https://mailpit.axllent.org/docs/usage/tagging/) +- Real-time web UI updates using web sockets for new mail & optional browser notifications for new mail (when accessed +via either HTTPS or `localhost` only) +- SMTP server with optional [STARTTLS & SMTP authentication](https://mailpit.axllent.org/docs/configuration/smtp-authentication/) (including an +"accept any" mode) +- [SMTP relaying](https://mailpit.axllent.org/docs/configuration/smtp-relay/) (message release) - relay messages via a different SMTP server +including an optional allowlist of accepted recipients +- Fast SMTP processing & storing - approximately 70-100 emails per second depending on CPU, network speed & email size, +easily handling tens of thousands of emails - Configurable automatic email pruning (default keeps the most recent 500 emails) -- Email storage either in a temporary or persistent database ([see wiki](https://github.com/axllent/mailpit/wiki/Email-storage)) -- Fast SMTP processing & storing - approximately 70-100 emails per second depending on CPU, network speed & email size, easily handling tens of thousands of emails -- SMTP relaying / message release - relay messages via a different SMTP server including an optional allowlist of accepted recipients ([see wiki](https://github.com/axllent/mailpit/wiki/SMTP-relay)) -- Optional SMTP with STARTTLS & SMTP authentication, including an "accept anything" mode ([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 ([see docs](docs/apiv1/README.md)) -- Optional webhook for received messages ([see docs](https://github.com/axllent/mailpit/wiki/Webhook)) -- Multi-architecture [Docker images](https://github.com/axllent/mailpit/wiki/Docker-images) +- A simple [REST API](https://mailpit.axllent.org/docs/api-v1/) for integration testing +- Optional [webhook](https://mailpit.axllent.org/docs/integration/webhook/) for received messages +- Multi-architecture [Docker images](https://mailpit.axllent.org/docs/install/docker/) ## Installation @@ -71,26 +71,28 @@ Static binaries can always be found on the [releases](https://github.com/axllent ### Docker -See [Docker instructions](https://github.com/axllent/mailpit/wiki/Docker-images) for 386, amd64 & arm64 images. +See [Docker instructions](https://mailpit.axllent.org/docs/install/docker/) for 386, amd64 & arm64 images. ### Compile from source -To build Mailpit from source, see [Building from source](https://github.com/axllent/mailpit/wiki/Building-from-source). +To build Mailpit from source, see [Building from source](https://mailpit.axllent.org/docs/install/source/). ## Usage -Run `mailpit -h` to see options. More information can be seen in [the docs](https://github.com/axllent/mailpit/wiki/Runtime-options). +Run `mailpit -h` to see options. More information can be seen in [the docs](https://mailpit.axllent.org/docs/configuration/runtime-options/). If installed using homebrew, you may run `brew services start mailpit` to always run mailpit automatically. ### Testing Mailpit -Please refer to [the documentation](https://github.com/axllent/mailpit/wiki/Testing-Mailpit) on how to easily test email delivery to Mailpit. +Please refer to [the documentation](https://mailpit.axllent.org/docs/install/testing/) on how to easily test email delivery to Mailpit. ### Configuring sendmail -Mailpit's SMTP server (default on port 1025), so you will likely need to configure your sending application to deliver mail via that port. A common MTA (Mail Transfer Agent) that delivers system emails to an SMTP server is `sendmail`, used by many applications, including PHP. Mailpit can also act as substitute for sendmail. For instructions on how to set this up, please refer to the [sendmail documentation](https://github.com/axllent/mailpit/wiki/Configuring-sendmail). +Mailpit's SMTP server (default on port 1025), so you will likely need to configure your sending application to deliver mail via that port. +A common MTA (Mail Transfer Agent) that delivers system emails to an SMTP server is `sendmail`, used by many applications, including PHP. +Mailpit can also act as substitute for sendmail. For instructions on how to set this up, please refer to the [sendmail documentation](https://mailpit.axllent.org/docs/install/sendmail/). diff --git a/cmd/reindex.go b/cmd/reindex.go index 97ad990d9..e1120c042 100644 --- a/cmd/reindex.go +++ b/cmd/reindex.go @@ -1,7 +1,3 @@ -/* -Copyright © 2022-Now() Ralph Slooten -This file is part of a CLI application. -*/ package cmd import ( diff --git a/cmd/root.go b/cmd/root.go index d5715c1b2..6e2ef4fd5 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -29,7 +29,7 @@ It acts as an SMTP server, and provides a web interface to view all captured ema Documentation: https://github.com/axllent/mailpit - https://github.com/axllent/mailpit/wiki`, + https://mailpit.axllent.org/docs/`, Run: func(_ *cobra.Command, _ []string) { if err := config.VerifyConfig(); err != nil { logger.Log().Error(err.Error()) diff --git a/docs/apiv1/README.md b/docs/apiv1/README.md index 682f52388..83e2429d7 100644 --- a/docs/apiv1/README.md +++ b/docs/apiv1/README.md @@ -4,7 +4,7 @@ Mailpit provides a simple REST API to access and delete stored messages. If the Mailpit server is set to use Basic Authentication, then API requests must use Basic Authentication too. -You can view the Swagger API documentation directly within Mailpit by going to `http://0.0.0.0:8025/api/v1/`. +You can view the Swagger API documentation directly within Mailpit by going to https://mailpit.axllent.org/docs/api-v1/. The API is split into four main parts: diff --git a/server/ui-src/components/AboutMailpit.vue b/server/ui-src/components/AboutMailpit.vue index e0f6702a9..4e7add961 100644 --- a/server/ui-src/components/AboutMailpit.vue +++ b/server/ui-src/components/AboutMailpit.vue @@ -179,8 +179,7 @@ export default {
From 153eb3df53492953759b43ab8b374a852ed2a98a Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Sat, 28 Oct 2023 17:33:11 +1300 Subject: [PATCH 07/11] Fix: Correctly display "About" modal when update check fails (resolves #199) --- internal/updater/updater.go | 22 +++++++++++++++++++--- server/apiv1/info.go | 2 +- server/ui-src/components/AboutMailpit.vue | 6 +++++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/internal/updater/updater.go b/internal/updater/updater.go index 4ea6bea5f..f9805502a 100644 --- a/internal/updater/updater.go +++ b/internal/updater/updater.go @@ -1,3 +1,4 @@ +// package Updater checks and downloads new versions package updater import ( @@ -6,13 +7,14 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "os" "os/exec" "path/filepath" "runtime" + "time" + "github.com/axllent/mailpit/config" "github.com/axllent/mailpit/internal/logger" "github.com/axllent/semver" ) @@ -49,13 +51,27 @@ type Release struct { func GithubLatest(repo, name string) (string, string, string, error) { releaseURL := fmt.Sprintf("https://api.github.com/repos/%s/releases", repo) - resp, err := http.Get(releaseURL) // #nosec + timeout := time.Duration(5 * time.Second) + + client := http.Client{ + Timeout: timeout, + } + + req, err := http.NewRequest("GET", releaseURL, nil) if err != nil { return "", "", "", err } + + req.Header.Set("User-Agent", "Mailpit/"+config.Version) + + resp, err := client.Do(req) + if err != nil { + return "", "", "", err + } + defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return "", "", "", err diff --git a/server/apiv1/info.go b/server/apiv1/info.go index d0dd123c6..85afe9e7c 100644 --- a/server/apiv1/info.go +++ b/server/apiv1/info.go @@ -30,7 +30,7 @@ type appInformation struct { } // AppInfo returns some basic details about the running app, and latest release. -func AppInfo(w http.ResponseWriter, r *http.Request) { +func AppInfo(w http.ResponseWriter, _ *http.Request) { // swagger:route GET /api/v1/info application AppInformation // // # Get application information diff --git a/server/ui-src/components/AboutMailpit.vue b/server/ui-src/components/AboutMailpit.vue index 4e7add961..4c6cdfc6d 100644 --- a/server/ui-src/components/AboutMailpit.vue +++ b/server/ui-src/components/AboutMailpit.vue @@ -159,8 +159,12 @@ export default {