From 602a8f10b645d9eaef59bb4091fec0873927ffff Mon Sep 17 00:00:00 2001 From: SirLouen Date: Thu, 20 Mar 2025 17:35:47 +0100 Subject: [PATCH 1/5] Adding Mailhog Support --- .env.example | 3 +++ docker-compose.yml | 14 ++++++++++++++ tools/local-env/scripts/start.js | 13 ++++++++++--- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 55f78229c03af..d8e3bf20ab87b 100644 --- a/.env.example +++ b/.env.example @@ -36,6 +36,9 @@ LOCAL_PHP_XDEBUG_MODE=develop,debug # Whether or not to enable Memcached. LOCAL_PHP_MEMCACHED=false +# Whether or not to enable MailHog. +LOCAL_MAILHOG=true + ## # The database software to use. # diff --git a/docker-compose.yml b/docker-compose.yml index 48f3abc607b03..4ceeb1029a1c6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -122,6 +122,20 @@ services: mysql: condition: service_healthy + ## + # The MailHog container. + ## + mailhog: + container_name: mailhog + image: mailhog/mailhog + logging: + driver: 'none' + ports: + - 1025:1025 # smtp server + - 8025:8025 # web ui + networks: + - wpdevnet + ## # The Memcached container. ## diff --git a/tools/local-env/scripts/start.js b/tools/local-env/scripts/start.js index 0dc8b9570063d..3d025149b1225 100644 --- a/tools/local-env/scripts/start.js +++ b/tools/local-env/scripts/start.js @@ -28,9 +28,16 @@ try { } // Start the local-env containers. -const containers = ( process.env.LOCAL_PHP_MEMCACHED === 'true' ) - ? 'wordpress-develop memcached' - : 'wordpress-develop'; +let containers = 'wordpress-develop'; + +if ( process.env.LOCAL_PHP_MEMCACHED === 'true' ) { + containers += ' memcached'; +} + +if ( process.env.LOCAL_MAILHOG === 'true' ) { + containers += ' mailhog'; +} + execSync( `docker compose ${composeFiles} up --quiet-pull -d ${containers}`, { stdio: 'inherit' } ); // If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM. From 2ffe4326a6596bc9521baa46118b57687237de57 Mon Sep 17 00:00:00 2001 From: SirLouen Date: Thu, 20 Mar 2025 17:38:38 +0100 Subject: [PATCH 2/5] Better mailhog disabled by default --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index d8e3bf20ab87b..5f42c7daa2f00 100644 --- a/.env.example +++ b/.env.example @@ -37,7 +37,7 @@ LOCAL_PHP_XDEBUG_MODE=develop,debug LOCAL_PHP_MEMCACHED=false # Whether or not to enable MailHog. -LOCAL_MAILHOG=true +LOCAL_MAILHOG=false ## # The database software to use. From 5c6b51487f8b7fccb5f1b659cb5afbaa0f4f67d1 Mon Sep 17 00:00:00 2001 From: SirLouen Date: Fri, 20 Jun 2025 23:00:39 +0200 Subject: [PATCH 3/5] Fix containers push --- tools/local-env/scripts/start.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/local-env/scripts/start.js b/tools/local-env/scripts/start.js index 4d46197aed8e5..e8aff8d15d359 100644 --- a/tools/local-env/scripts/start.js +++ b/tools/local-env/scripts/start.js @@ -36,7 +36,7 @@ if ( process.env.LOCAL_PHP_MEMCACHED === 'true' ) { } if ( process.env.LOCAL_MAILHOG === 'true' ) { - containers += ' mailhog'; + containers.push( 'mailhog' ); } spawnSync( From a8e6a29a1936655db603e3355823646b013f4ded Mon Sep 17 00:00:00 2001 From: SirLouen Date: Thu, 10 Jul 2025 13:49:15 +0200 Subject: [PATCH 4/5] Switching to Mailpit --- .env.example | 4 ++-- docker-compose.yml | 15 ++++++++++----- tools/local-env/scripts/start.js | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 5f42c7daa2f00..7845299dd7828 100644 --- a/.env.example +++ b/.env.example @@ -36,8 +36,8 @@ LOCAL_PHP_XDEBUG_MODE=develop,debug # Whether or not to enable Memcached. LOCAL_PHP_MEMCACHED=false -# Whether or not to enable MailHog. -LOCAL_MAILHOG=false +# Whether or not to enable Mail Server. +LOCAL_MAIL=false ## # The database software to use. diff --git a/docker-compose.yml b/docker-compose.yml index 2acc416d84bdd..1f76ae3d7d51a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -129,14 +129,19 @@ services: ## # The MailHog container. ## - mailhog: - container_name: mailhog - image: mailhog/mailhog - logging: - driver: 'none' + mailpit: + container_name: mailpit + image: axllent/mailpit ports: - 1025:1025 # smtp server - 8025:8025 # web ui + volumes: + - ./data:/data + environment: + MP_MAX_MESSAGES: 5000 + MP_DATABASE: /data/mailpit.db + MP_SMTP_AUTH_ACCEPT_ANY: 1 + MP_SMTP_AUTH_ALLOW_INSECURE: 1 networks: - wpdevnet diff --git a/tools/local-env/scripts/start.js b/tools/local-env/scripts/start.js index e8aff8d15d359..4ab2e10e913c8 100644 --- a/tools/local-env/scripts/start.js +++ b/tools/local-env/scripts/start.js @@ -35,8 +35,8 @@ if ( process.env.LOCAL_PHP_MEMCACHED === 'true' ) { containers.push( 'memcached' ); } -if ( process.env.LOCAL_MAILHOG === 'true' ) { - containers.push( 'mailhog' ); +if ( process.env.LOCAL_MAIL === 'true' ) { + containers.push( 'mailpit' ); } spawnSync( From 8e9573cf5dce681171515871a00dd3577fb1ecaf Mon Sep 17 00:00:00 2001 From: SirLouen Date: Mon, 25 Aug 2025 23:22:06 +0200 Subject: [PATCH 5/5] Remove forced data directory --- docker-compose.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1f76ae3d7d51a..92eadaaf56268 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -135,11 +135,8 @@ services: ports: - 1025:1025 # smtp server - 8025:8025 # web ui - volumes: - - ./data:/data environment: MP_MAX_MESSAGES: 5000 - MP_DATABASE: /data/mailpit.db MP_SMTP_AUTH_ACCEPT_ANY: 1 MP_SMTP_AUTH_ALLOW_INSECURE: 1 networks: