From a426f64795667bd144151c0ebec4ec57cfcb85f1 Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Wed, 14 Sep 2022 16:57:01 +1200 Subject: [PATCH 1/8] Feature: Add --quiet flag to display only errors --- cmd/root.go | 1 + config/config.go | 3 +++ logger/logger.go | 8 ++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index f5e25d3..4fafb67 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -136,6 +136,7 @@ func init() { rootCmd.Flags().StringVar(&config.SMTPSSLCert, "smtp-ssl-cert", config.SMTPSSLCert, "SSL certificate for SMTP - requires smtp-ssl-key") rootCmd.Flags().StringVar(&config.SMTPSSLKey, "smtp-ssl-key", config.SMTPSSLKey, "SSL key for SMTP - requires smtp-ssl-cert") + rootCmd.Flags().BoolVarP(&config.QuietLogging, "quiet", "q", false, "Quiet logging (errors only)") rootCmd.Flags().BoolVarP(&config.VerboseLogging, "verbose", "v", false, "Verbose logging") // deprecated 2022/08/06 diff --git a/config/config.go b/config/config.go index 0fb67db..ed199d3 100644 --- a/config/config.go +++ b/config/config.go @@ -26,6 +26,9 @@ var ( // VerboseLogging for console output VerboseLogging = false + // QuietLogging for console output (errors only) + QuietLogging = false + // NoLogging for tests NoLogging = false diff --git a/logger/logger.go b/logger/logger.go index aa0e30f..63ca810 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -19,9 +19,13 @@ func Log() *logrus.Logger { log = logrus.New() log.SetLevel(logrus.InfoLevel) if config.VerboseLogging { + // verbose logging (debug) log.SetLevel(logrus.DebugLevel) - } - if config.NoLogging { + } else if config.QuietLogging { + // show errors only + log.SetLevel(logrus.ErrorLevel) + } else if config.NoLogging { + // disable all logging (tests) log.SetLevel(logrus.PanicLevel) } From 6aeebb9824b93261ba8270db34ebf8eac76b28b0 Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Wed, 14 Sep 2022 17:12:41 +1200 Subject: [PATCH 2/8] UI: Remove left & right borders (message list) --- server/ui-src/App.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/ui-src/App.vue b/server/ui-src/App.vue index dd9c297..e87c580 100644 --- a/server/ui-src/App.vue +++ b/server/ui-src/App.vue @@ -569,14 +569,13 @@ export default {
{{ getRelativeCreated(message) }}
-
{{ message.From.Name ? message.From.Name : message.From.Address }}
From 4e2e59ec87d6cad9ee9084b683323e094fbfa1ad Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Wed, 14 Sep 2022 17:25:56 +1200 Subject: [PATCH 3/8] Update README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f1a5406..ab51f0c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Mailpit is inspired by [MailHog](#why-rewrite-mailhog), but much, much faster. - Runs entirely from a single binary, no installation required - SMTP server (default `0.0.0.0:1025`) -- Web UI to view emails (HTML format, text, source and MIME attachments, default `0.0.0.0:8025`) +- Web UI to view emails (formatted HTML, highlighted HTML source, text, raw source and MIME attachments including image thumbnails) - Real-time web UI updates using web sockets for new mail - Optional browser notifications for new mail (HTTPS only) - Configurable automatic email pruning (default keeps the most recent 500 emails) @@ -44,6 +44,8 @@ Or download a pre-built binary in the [releases](https://github.com/axllent/mail To build Mailpit from source see [building from source](https://github.com/axllent/mailpit/wiki/Building-from-source). +The Mailpit web UI listens by default on `http://0.0.0.0:8025`, and the SMTP port on `0.0.0.0:1025`. + ### Configuring sendmail From f6a8de32150407469750a153ba07b3aaf0699a3c Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Wed, 14 Sep 2022 22:37:47 +1200 Subject: [PATCH 4/8] UI: Add favicon unread message counter --- package-lock.json | 11 +++++++++++ package.json | 1 + server/ui-src/App.vue | 33 +++++++++++++++++++++++++++++---- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index bba2966..3b686c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "bootstrap-icons": "^1.9.1", "moment": "^2.29.4", "prismjs": "^1.29.0", + "tinycon": "^0.6.8", "vue": "^3.2.13" }, "devDependencies": { @@ -1124,6 +1125,11 @@ "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==" }, + "node_modules/tinycon": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/tinycon/-/tinycon-0.6.8.tgz", + "integrity": "sha512-bF8Lxm4JUXF6Cw0XlZdugJ44GV575OinZ0Pt8vQPr8ooNqd2yyNkoFdCHzmdpHlgoqfSLfcyk4HDP1EyllT+ug==" + }, "node_modules/tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", @@ -1902,6 +1908,11 @@ "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==" }, + "tinycon": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/tinycon/-/tinycon-0.6.8.tgz", + "integrity": "sha512-bF8Lxm4JUXF6Cw0XlZdugJ44GV575OinZ0Pt8vQPr8ooNqd2yyNkoFdCHzmdpHlgoqfSLfcyk4HDP1EyllT+ug==" + }, "tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", diff --git a/package.json b/package.json index e05fea0..01c3771 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "bootstrap-icons": "^1.9.1", "moment": "^2.29.4", "prismjs": "^1.29.0", + "tinycon": "^0.6.8", "vue": "^3.2.13" }, "devDependencies": { diff --git a/server/ui-src/App.vue b/server/ui-src/App.vue index e87c580..c6d9269 100644 --- a/server/ui-src/App.vue +++ b/server/ui-src/App.vue @@ -1,7 +1,8 @@