devilbox/docs/custom-container/integrate-mailhog.rst
2018-08-12 13:20:17 +02:00

3.2 KiB

Integrate Mailhog

This section will guide you through getting Mailhog integrated into the Devilbox.

Table of Contents

local

Overview

The Devilbox ships various example configurations to overwrite the default stack. Those files are located under compose/ in the Devilbox git directory.

In case of Mailhog, the file is compose/docker-compose.override.yml-mailhog. This file must be copied into the root of the Devilbox git directory.

What How and where
Example compose file compose/docker-compose.override.yml-mailhog
Container IP address 172.16.238.201
Exposed port 8025
Available at http://localhost:8025
Container name mailhog
Further configuration php.ini settings need to be applied per version

Instructions

Copy example docker-compose.override.yml

Copy the mailhog Docker Compose overwrite file into the root of the Devilbox git directory.

host> cp compose/docker-compose.override.yml-mailhog docker-compose.override.yml

* docker_compose_override_yml * add_your_own_docker_image * overwrite_existing_docker_image

Adjust PHP settings

The next step is to tell PHP that it should use a different mail forwarder.

Let's assume you are using PHP 7.2.

# Navigate to the PHP ini configuration directory of your chosen version
host> cd cfg/php-ini-7.2

# Create and open a new *.ini file
host> vi mailhog.ini

Add the following content to the newly created ini file:

[mail function]
sendmail_path = '/usr/local/bin/mhsendmail --smtp-addr="mailhog:1025"'

php_ini

Start the Devilbox

The final step is to start the Devilbox with mailhog.

Let's assume you want to start php, httpd, bind, mysql and mailhog.

host> docker-compose up -d php httpd bind mysql mailhog

start_the_devilbox

Functionality

  • Once the Devilbox is running, visit http://localhost:8025 in your browser.
  • Any email send by any of the Devilbox managed projects will then appear in Mailhog