Skip to content

Commit 045319a

Browse files
committed
Install DMA & add documentation (related to thecodingmachine#204)
1 parent 7353627 commit 045319a

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

utils/Dockerfile.blueprint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
ARG INSTALL_CRON=1
44
ARG INSTALL_COMPOSER=1
5+
ARG INSTALL_DMA=1
56
ARG PHP_VERSION
67
ARG GLOBAL_VERSION
78
FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-{{ $variant }}

utils/Dockerfile.slim.blueprint

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,3 +418,18 @@ ONBUILD RUN if [ -n "$NODE_VERSION" ]; then \
418418
sudo apt-get update && \
419419
sudo apt-get install -y --no-install-recommends yarn; \
420420
fi;
421+
422+
# |--------------------------------------------------------------------------
423+
# | DragonFly Mail Agent
424+
# |--------------------------------------------------------------------------
425+
# |
426+
# | Installs DragonFly Mail Agent, a sendmail-compatible MTA that can be used
427+
# | to send email from PHP, either using direct delivery or through an SMTP
428+
# | smarthost.
429+
# |
430+
431+
ONBUILD ARG INSTALL_DMA
432+
ONBUILD RUN if [ -n "$INSTALL_DMA" ]; then \
433+
sudo apt-get update && \
434+
sudo apt-get install -y --no-install-recommends dma
435+

utils/README.blueprint.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,34 @@ ENV APACHE_RUN_USER=www-data \
359359
```
360360

361361

362+
## Sending email
363+
364+
The `sendmail` binary is available through [DragonFly Mail Agent (DMA)](https://wiki.mageia.org/en/Dma_Dragonfly_Mail_Agent) to make the [`mail()`](https://www.php.net/manual/de/function.mail.php) function work. Without configuration, it sends email directly, using `[email protected]` as the sender by default - this won't work for various reasons (greylisting, spam blacklists, SPF record of example.org, ...), and email is quite complex to set up correctly with direct delivery.
365+
366+
**Important**: To reliably send email, you thus should specify a smarthost which will be used as an SMTP relay - all you need is an account at any email provider that supports SMTP (ideally suited for mass/transactional mails, according to your usecase - e.g. Mailgun, Postmark, or a self-hosted [Postal](https://github.com/postalhq/postal) instance). Then, to configure DMA, you'll just have to set the following environment variables:
367+
368+
```bash
369+
# your sender address
370+
371+
# your smarthost settings
372+
DMA_CONF_SMARTHOST=smtp.example.org
373+
DMA_AUTH_USERNAME=noreply
374+
DMA_AUTH_PASSWORD=helloworld123
375+
# further DMA settings, according to the DMA man page, prefixed with DMA_CONF_
376+
# (see https://manpages.debian.org/unstable/dma/sendmail.8.en.html#dma.conf)
377+
DMA_CONF_STARTTLS=1
378+
```
379+
380+
DMA is **installed by default in the fat images**. If you are using the "*slim*" images, you need to install it by passing
381+
a single argument before the "FROM" clause in your Dockerfile:
382+
383+
```Dockerfile
384+
ARG INSTALL_DMA=1
385+
FROM thecodingmachine/php:{{ $image.php_version }}-v3-slim-apache
386+
# The build triggers automatically the installation of DragonFly Mail Agent
387+
```
388+
389+
362390
## Setting up CRON jobs
363391

364392
You can set up CRON jobs using environment variables too.

0 commit comments

Comments
 (0)