1

I am using the official cloud docker image to setup local environment docker-development

However it cannot send out email even if I already put

environment: - ENABLE_SENDMAIL=true

Under fpm container in docker-compose.yml

2 Answers 2

2

This is due to docker image version incompatibility.

If you are using 'magento/magento-cloud-docker-php:7.4-fpm-1.2.4 in your fpm container, you can check the dockerfile is detecting

ENV ENABLE_SENDMAIL=true

7.4-fpm-1.2.4

But if you are using 'magento/magento-cloud-docker-php:7.4-fpm-1.3.0'

You will see

ENV SENDMAIL_PATH=/dev/null

7.4-fpm-1.3.0

which are totally different variables.

So the solution is to add a new SENDMAIL_PATH to let fpm container to know which email service should be used. Under docker-compose.yml fpm section, add the following:

environment:
      - SENDMAIL_PATH=/usr/local/bin/mhsendmail --smtp-addr="mailhog:1025"

Then you can now see your email appear in the :8025 mailhog panel.

1

@leo solution works, but it´s not persistent. To make it persistent, in the .docker/ folder, there is a distributable file called config.php.dist as a template for the environment configuration. Rename it to config.php and add the sendmail_path configuration there:

    'SENDMAIL_PATH' => '/usr/local/bin/mhsendmail --smtp-addr="mailhog:1025"'

Execute the ece tool to generate the docker-compose.yml file: vendor/bin/ece-docker build:compose. And you are all set!

Note 1: If you don´t have the distributable file, run vendor/bin/ece-docker build:dist. It will generate two files inside .docker/ folder: config.env and config.php.dist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.