Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ci/image-tests/Checks/PostfixChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ public function testMailFromPhpFpmReachesTheRelayHost(): void
$this->assertMailArrived('fpm-fcgi', $container);
}

/**
* A mail with UTF-8 in its subject reaches the relay host, which, like many mail catchers, does not offer
* SMTPUTF8.
*/
public function testMailWithUtf8InTheSubjectReachesTheRelayHost(): void
{
$container = $this->mailContainer();
self::assertSame('sent', $this->stdout(
"php -r 'echo mail(\"someone@example.test\", \"Image test with UTF-8: Grüße\", \"Sent by the image tests\") ? \"sent\" : \"not sent\";' 2>/dev/null",
$container,
));
$this->waitFor(function () use ($container): void {
self::assertStringContainsString('Subject: Image test with UTF-8: Grüße', $this->stdout('cat /tmp/image-tests/mail/*.eml 2>/dev/null || true', $container));
});
}

/**
* The environment container with the SMTP sink running. A second sink exits, because the port is taken.
*/
Expand Down
4 changes: 3 additions & 1 deletion docker/base/alpine/conf/bin/service.d/postfix.d/10-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ cp -f /etc/services /var/spool/postfix/etc/services

go-replace --mode=line --regex -s '^[\s]*myhostname[\s]*=.*' -r "myhostname = $HOSTNAME"

# General
# General; without SMTPUTF8, mail with UTF-8 in its headers also reaches a relay host that does not offer it, such
# as many mail catchers
go-replace --mode=lineinfile --regex \
-s '^[\s]*myhostname[\s]*=.*.*' -r "myhostname = $HOSTNAME" \
-s '^[\s]*inet_interfaces[\s]*=.*' -r "inet_interfaces = 127.0.0.1" \
-s '^[\s]*smtputf8_enable[\s]*=.*' -r "smtputf8_enable = no" \
-- /etc/postfix/main.cf

## REPLAYHOST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ cp -f /etc/services /var/spool/postfix/etc/services

go-replace --mode=line --regex -s '^[\s]*myhostname[\s]*=.*' -r "myhostname = $HOSTNAME"

# General
# General; without SMTPUTF8, mail with UTF-8 in its headers also reaches a relay host that does not offer it, such
# as many mail catchers
go-replace --mode=lineinfile --regex \
-s '^[\s]*myhostname[\s]*=.*.*' -r "myhostname = $HOSTNAME" \
-s '^[\s]*inet_interfaces[\s]*=.*' -r "inet_interfaces = 127.0.0.1" \
-s '^[\s]*smtputf8_enable[\s]*=.*' -r "smtputf8_enable = no" \
-- /etc/postfix/main.cf

## REPLAYHOST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ cp -f /etc/services /var/spool/postfix/etc/services

go-replace --mode=line --regex -s '^[\s]*myhostname[\s]*=.*' -r "myhostname = $HOSTNAME"

# General
# General; without SMTPUTF8, mail with UTF-8 in its headers also reaches a relay host that does not offer it, such
# as many mail catchers
go-replace --mode=lineinfile --regex \
-s '^[\s]*myhostname[\s]*=.*.*' -r "myhostname = $HOSTNAME" \
-s '^[\s]*inet_interfaces[\s]*=.*' -r "inet_interfaces = 127.0.0.1" \
-s '^[\s]*smtputf8_enable[\s]*=.*' -r "smtputf8_enable = no" \
-- /etc/postfix/main.cf

## REPLAYHOST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ cp -f /etc/services /var/spool/postfix/etc/services

go-replace --mode=line --regex -s '^[\s]*myhostname[\s]*=.*' -r "myhostname = $HOSTNAME"

# General
# General; without SMTPUTF8, mail with UTF-8 in its headers also reaches a relay host that does not offer it, such
# as many mail catchers
go-replace --mode=lineinfile --regex \
-s '^[\s]*myhostname[\s]*=.*.*' -r "myhostname = $HOSTNAME" \
-s '^[\s]*inet_interfaces[\s]*=.*' -r "inet_interfaces = 127.0.0.1" \
-s '^[\s]*smtputf8_enable[\s]*=.*' -r "smtputf8_enable = no" \
-- /etc/postfix/main.cf

## REPLAYHOST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ cp -f /etc/services /var/spool/postfix/etc/services

go-replace --mode=line --regex -s '^[\s]*myhostname[\s]*=.*' -r "myhostname = $HOSTNAME"

# General
# General; without SMTPUTF8, mail with UTF-8 in its headers also reaches a relay host that does not offer it, such
# as many mail catchers
go-replace --mode=lineinfile --regex \
-s '^[\s]*myhostname[\s]*=.*.*' -r "myhostname = $HOSTNAME" \
-s '^[\s]*inet_interfaces[\s]*=.*' -r "inet_interfaces = 127.0.0.1" \
-s '^[\s]*smtputf8_enable[\s]*=.*' -r "smtputf8_enable = no" \
-- /etc/postfix/main.cf

## REPLAYHOST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ cp -f /etc/services /var/spool/postfix/etc/services

go-replace --mode=line --regex -s '^[\s]*myhostname[\s]*=.*' -r "myhostname = $HOSTNAME"

# General
# General; without SMTPUTF8, mail with UTF-8 in its headers also reaches a relay host that does not offer it, such
# as many mail catchers
go-replace --mode=lineinfile --regex \
-s '^[\s]*myhostname[\s]*=.*.*' -r "myhostname = $HOSTNAME" \
-s '^[\s]*inet_interfaces[\s]*=.*' -r "inet_interfaces = 127.0.0.1" \
-s '^[\s]*smtputf8_enable[\s]*=.*' -r "smtputf8_enable = no" \
-- /etc/postfix/main.cf

## REPLAYHOST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ cp -f /etc/services /var/spool/postfix/etc/services

go-replace --mode=line --regex -s '^[\s]*myhostname[\s]*=.*' -r "myhostname = $HOSTNAME"

# General
# General; without SMTPUTF8, mail with UTF-8 in its headers also reaches a relay host that does not offer it, such
# as many mail catchers
go-replace --mode=lineinfile --regex \
-s '^[\s]*myhostname[\s]*=.*.*' -r "myhostname = $HOSTNAME" \
-s '^[\s]*inet_interfaces[\s]*=.*' -r "inet_interfaces = 127.0.0.1" \
-s '^[\s]*smtputf8_enable[\s]*=.*' -r "smtputf8_enable = no" \
-- /etc/postfix/main.cf

## REPLAYHOST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ cp -f /etc/services /var/spool/postfix/etc/services

go-replace --mode=line --regex -s '^[\s]*myhostname[\s]*=.*' -r "myhostname = $HOSTNAME"

# General
# General; without SMTPUTF8, mail with UTF-8 in its headers also reaches a relay host that does not offer it, such
# as many mail catchers
go-replace --mode=lineinfile --regex \
-s '^[\s]*myhostname[\s]*=.*.*' -r "myhostname = $HOSTNAME" \
-s '^[\s]*inet_interfaces[\s]*=.*' -r "inet_interfaces = 127.0.0.1" \
-s '^[\s]*smtputf8_enable[\s]*=.*' -r "smtputf8_enable = no" \
-- /etc/postfix/main.cf

## REPLAYHOST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ cp -f /etc/services /var/spool/postfix/etc/services

go-replace --mode=line --regex -s '^[\s]*myhostname[\s]*=.*' -r "myhostname = $HOSTNAME"

# General
# General; without SMTPUTF8, mail with UTF-8 in its headers also reaches a relay host that does not offer it, such
# as many mail catchers
go-replace --mode=lineinfile --regex \
-s '^[\s]*myhostname[\s]*=.*.*' -r "myhostname = $HOSTNAME" \
-s '^[\s]*inet_interfaces[\s]*=.*' -r "inet_interfaces = 127.0.0.1" \
-s '^[\s]*smtputf8_enable[\s]*=.*' -r "smtputf8_enable = no" \
-- /etc/postfix/main.cf

## REPLAYHOST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ cp -f /etc/services /var/spool/postfix/etc/services

go-replace --mode=line --regex -s '^[\s]*myhostname[\s]*=.*' -r "myhostname = $HOSTNAME"

# General
# General; without SMTPUTF8, mail with UTF-8 in its headers also reaches a relay host that does not offer it, such
# as many mail catchers
go-replace --mode=lineinfile --regex \
-s '^[\s]*myhostname[\s]*=.*.*' -r "myhostname = $HOSTNAME" \
-s '^[\s]*inet_interfaces[\s]*=.*' -r "inet_interfaces = 127.0.0.1" \
-s '^[\s]*smtputf8_enable[\s]*=.*' -r "smtputf8_enable = no" \
-- /etc/postfix/main.cf

## REPLAYHOST
Expand Down
2 changes: 2 additions & 0 deletions docs/images/php.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ services:

The `-dev` images start Postfix. It has no relay host and delivers each message directly to the recipient's mail server.

Postfix does not use SMTPUTF8 (`smtputf8_enable = no`), so a message with UTF-8 in its headers, for example in the subject, also reaches a relay host or mail catcher that does not offer it.

> [!WARNING]
> Without a relay host, Postfix in a development container tries to deliver mail to real recipients. Send it to a mail catcher such as [Mailpit](https://mailpit.axllent.org/) instead.

Expand Down
4 changes: 3 additions & 1 deletion provisioning/base/general/bin/service.d/postfix.d/10-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ cp -f /etc/services /var/spool/postfix/etc/services

go-replace --mode=line --regex -s '^[\s]*myhostname[\s]*=.*' -r "myhostname = $HOSTNAME"

# General
# General; without SMTPUTF8, mail with UTF-8 in its headers also reaches a relay host that does not offer it, such
# as many mail catchers
go-replace --mode=lineinfile --regex \
-s '^[\s]*myhostname[\s]*=.*.*' -r "myhostname = $HOSTNAME" \
-s '^[\s]*inet_interfaces[\s]*=.*' -r "inet_interfaces = 127.0.0.1" \
-s '^[\s]*smtputf8_enable[\s]*=.*' -r "smtputf8_enable = no" \
-- /etc/postfix/main.cf

## REPLAYHOST
Expand Down
Loading