Skip to content

Commit e0e0435

Browse files
committed
Apply Dockerfile and README changes
1 parent 045319a commit e0e0435

File tree

7 files changed

+76
-0
lines changed

7 files changed

+76
-0
lines changed

Dockerfile.apache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ARG INSTALL_CRON=1
22
ARG INSTALL_COMPOSER=1
3+
ARG INSTALL_DMA=1
34
ARG PHP_VERSION
45
ARG GLOBAL_VERSION
56
FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-apache

Dockerfile.cli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ARG INSTALL_CRON=1
22
ARG INSTALL_COMPOSER=1
3+
ARG INSTALL_DMA=1
34
ARG PHP_VERSION
45
ARG GLOBAL_VERSION
56
FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-cli

Dockerfile.fpm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ARG INSTALL_CRON=1
22
ARG INSTALL_COMPOSER=1
3+
ARG INSTALL_DMA=1
34
ARG PHP_VERSION
45
ARG GLOBAL_VERSION
56
FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-fpm

Dockerfile.slim.apache

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,3 +386,18 @@ ONBUILD RUN if [ -n "$NODE_VERSION" ]; then \
386386
sudo apt-get update && \
387387
sudo apt-get install -y --no-install-recommends yarn; \
388388
fi;
389+
390+
# |--------------------------------------------------------------------------
391+
# | DragonFly Mail Agent
392+
# |--------------------------------------------------------------------------
393+
# |
394+
# | Installs DragonFly Mail Agent, a sendmail-compatible MTA that can be used
395+
# | to send email from PHP, either using direct delivery or through an SMTP
396+
# | smarthost.
397+
# |
398+
399+
ONBUILD ARG INSTALL_DMA
400+
ONBUILD RUN if [ -n "$INSTALL_DMA" ]; then \
401+
sudo apt-get update && \
402+
sudo apt-get install -y --no-install-recommends dma
403+

Dockerfile.slim.cli

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,18 @@ ONBUILD RUN if [ -n "$NODE_VERSION" ]; then \
291291
sudo apt-get update && \
292292
sudo apt-get install -y --no-install-recommends yarn; \
293293
fi;
294+
295+
# |--------------------------------------------------------------------------
296+
# | DragonFly Mail Agent
297+
# |--------------------------------------------------------------------------
298+
# |
299+
# | Installs DragonFly Mail Agent, a sendmail-compatible MTA that can be used
300+
# | to send email from PHP, either using direct delivery or through an SMTP
301+
# | smarthost.
302+
# |
303+
304+
ONBUILD ARG INSTALL_DMA
305+
ONBUILD RUN if [ -n "$INSTALL_DMA" ]; then \
306+
sudo apt-get update && \
307+
sudo apt-get install -y --no-install-recommends dma
308+

Dockerfile.slim.fpm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,3 +314,18 @@ ONBUILD RUN if [ -n "$NODE_VERSION" ]; then \
314314
sudo apt-get update && \
315315
sudo apt-get install -y --no-install-recommends yarn; \
316316
fi;
317+
318+
# |--------------------------------------------------------------------------
319+
# | DragonFly Mail Agent
320+
# |--------------------------------------------------------------------------
321+
# |
322+
# | Installs DragonFly Mail Agent, a sendmail-compatible MTA that can be used
323+
# | to send email from PHP, either using direct delivery or through an SMTP
324+
# | smarthost.
325+
# |
326+
327+
ONBUILD ARG INSTALL_DMA
328+
ONBUILD RUN if [ -n "$INSTALL_DMA" ]; then \
329+
sudo apt-get update && \
330+
sudo apt-get install -y --no-install-recommends dma
331+

README.md

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

406406

407+
## Sending email
408+
409+
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.
410+
411+
**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:
412+
413+
```bash
414+
# your sender address
415+
416+
# your smarthost settings
417+
DMA_CONF_SMARTHOST=smtp.example.org
418+
DMA_AUTH_USERNAME=noreply
419+
DMA_AUTH_PASSWORD=helloworld123
420+
# further DMA settings, according to the DMA man page, prefixed with DMA_CONF_
421+
# (see https://manpages.debian.org/unstable/dma/sendmail.8.en.html#dma.conf)
422+
DMA_CONF_STARTTLS=1
423+
```
424+
425+
DMA is **installed by default in the fat images**. If you are using the "*slim*" images, you need to install it by passing
426+
a single argument before the "FROM" clause in your Dockerfile:
427+
428+
```Dockerfile
429+
ARG INSTALL_DMA=1
430+
FROM thecodingmachine/php:7.4-v3-slim-apache
431+
# The build triggers automatically the installation of DragonFly Mail Agent
432+
```
433+
434+
407435
## Setting up CRON jobs
408436

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

0 commit comments

Comments
 (0)