Adding mailhog to a development enviroment.
Mailhog is an email testing tool. By installing, it:
localhost:1025localhost:8025Mailhog to an existing Ansible projectgeerlingguy.mailhog as requirement to project and install it.host_varsmailhog_enabled: true
mailhog_version: 1.0.1
roles/tasks/mailhog/main.yml:---
- name: "Prepare Mailhog"
apt:
name: build-essential
state: present
when: mailhog_enabled
tags: [mailhog]
- role: geerlingguy.mailhog
when: mailhog_enabled
tags: [mailhog]
provision.yml playbook: - role: mailhog
when: mailhog_enabled
tags: [mailhog]
You must set the STMP server to localhost, port to 1025 and disable SSL options.
Any user and password will be OK.
To enable basic auth, use the published mailhog-basic-auth-role. There is an example in odoo-12-test-inventory
To expose mailhog behind a Nginx reverse proxy, you must add the following configuration to:
location /mailhog {
chunked_transfer_encoding on;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://mailhog;
}
-ui-web-path=mailhog flag in command or MH_UI_WEB_PATH=mailhog enviroment variable.