From de3f2e6c856d3196b5ab83fa245423a065034b5f Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen.haas@lakedrops.com> Date: Wed, 10 Jan 2024 12:46:16 +0100 Subject: [PATCH] composer/plugin/docker4drupal#64 Add support for mailpit --- docs/composer/plugin/d4d/index.md | 25 +++++++++++++++++++------ docs/dev_tools/host.md | 10 ++++++++++ docs/docker/l3d/drupal.md | 28 +++++++++++++++++++++++++--- 3 files changed, 54 insertions(+), 9 deletions(-) diff --git a/docs/composer/plugin/d4d/index.md b/docs/composer/plugin/d4d/index.md index 86f0c2a..0ea1233 100644 --- a/docs/composer/plugin/d4d/index.md +++ b/docs/composer/plugin/d4d/index.md @@ -93,11 +93,11 @@ The following services are available in your browser while the Docker containers - Dashboard: http://docker.localhost:8080 - Drupal site: http://[PROJECTNAME].docker.localhost:8000 -- PhpMyAdmin: http://pma.[PROJECTNAME].docker.localhost:8000 -- Mailhog http://mailhog.[PROJECTNAME].docker.localhost:8000 -- Solr http://solr.[PROJECTNAME].docker.localhost:8000 -- Node http://front.[PROJECTNAME].docker.localhost:8000 -- Varnish http://varnish.[PROJECTNAME].docker.localhost:8000 +- PhpMyAdmin: http://pma-[PROJECTNAME].docker.localhost:8000 +- MailPit http://mailpit-[PROJECTNAME].docker.localhost:8000 +- Solr http://solr-[PROJECTNAME].docker.localhost:8000 +- Node http://front-[PROJECTNAME].docker.localhost:8000 +- Varnish http://varnish-[PROJECTNAME].docker.localhost:8000 Note that Solr, Node and Varnish are not enabled by default. See the [customization](/composer/plugin/d4d#customization) chapter below to learn how you can enable them. @@ -116,7 +116,7 @@ docker-compose logs -f [SERVICENAME] Each service has its own name: -- mailhog +- mailpit - mariadb - nginx - node @@ -237,11 +237,24 @@ docker4drupal: webserver: type: apache mailhog: + enable: 0 host: 'smtp.freesmtpservers.com' port: 25 username: '' password: '' mechanism: 'NONE' + mailpit: + enable: 1 + host: 'smtp.freesmtpservers.com' + port: 25 + username: '' + password: '' + auth: 'none' + starttls: '' + allowinsecure: '' + secret: '' + returnpath: '' + recipientallowlist: '' varnish: enable: 0 redis: diff --git a/docs/dev_tools/host.md b/docs/dev_tools/host.md index 61ad1a8..e52ac1c 100644 --- a/docs/dev_tools/host.md +++ b/docs/dev_tools/host.md @@ -39,6 +39,16 @@ MAILHOG_MECHANISM=NONE MAILHOG_PASSWORD= MAILHOG_PORT=25 MAILHOG_USERNAME= +MAILPIT_HOST=smtp.freesmtpservers.com +MAILPIT_PORT=25 +MAILPIT_USERNAME= +MAILPIT_PASSWORD= +MAILPIT_STARTTLS= +MAILPIT_ALLOW_INSECURE= +MAILPIT_AUTH=none +MAILPIT_SECRET= +MAILPIT_RETURNPATH= +MAILPIT_RECIPIENT_ALLOW_LIST= PHP_COVERAGE=0 PHP_DEBUG=0 PHP_VERSION=8.1 diff --git a/docs/docker/l3d/drupal.md b/docs/docker/l3d/drupal.md index 1a7c094..6159362 100644 --- a/docs/docker/l3d/drupal.md +++ b/docs/docker/l3d/drupal.md @@ -83,7 +83,7 @@ Based on this ID, ... - Docker4Drupal creates a number of containers depending on the services you require, e.g. - `project1_apache_1` - - `project1_mailhog_1` + - `project1_mailpit_1` - `project1_mariadb_1` - `project1_php_1` - `project1_pma_1` @@ -119,7 +119,7 @@ the following domain names will be used for the respective services: - `project1.docker.localhost:8000`: The Drupal website. - `pma-project1.docker.localhost:8000`: PhpMyAdmin of the project. -- `mailhog-project1.docker.localhost:8000`: The Mailhog service for the project. +- `mailpit-project1.docker.localhost:8000`: The Mailhog service for the project. - `bs-project1.docker.localhost:8000`: Browsersync instance when running Gulp. In other words, the project ID plus some service identifier are used as the @@ -247,9 +247,31 @@ With this setup, you can debug both web requests coming from the browser and CLI commands for PHP which is executed inside the PHP container like e.g. drush - all with the same setup. +## Using MailPit + +When using the [Docker4Drupal](../../composer/plugin/d4d/index.md), a MailPit service will be configured automatically by default. +This captures all outgoing email so that you can view those emails in a dashboard from your browser. Should you want +to release an email to see how it looks in you email client, MailPit provides a button to do that. This requires SMTP +server configuration, that you can provide in your local `.env` files like this: + +```bash +MAILPIT_HOST=smtp.freesmtpservers.com +MAILPIT_PORT=25 +MAILPIT_USERNAME= +MAILPIT_PASSWORD= +MAILPIT_STARTTLS= +MAILPIT_ALLOW_INSECURE= +MAILPIT_AUTH=none +MAILPIT_SECRET= +MAILPIT_RETURNPATH= +MAILPIT_RECIPIENT_ALLOW_LIST= +``` + +For more details about those parameters, please refer to [SMTP relay configuration](https://mailpit.axllent.org/docs/configuration/smtp-relay/#smtp-relay-configuration). + ## Using MailHog -When using the [Docker4Drupal](../../composer/plugin/d4d/index.md), a MailHog service will be configured automatically. +When using the [Docker4Drupal](../../composer/plugin/d4d/index.md), a MailHog service can be configured. This captures all outgoing email so that you can view those emails in a dashboard from your browser. Should you want to release an email to see how it looks in you email client, MailHog provides a button to do that. This requires SMTP server configuration, that you can provide in your local `.env` files like this: -- GitLab