Skip to content

Add Postfix SMTP relay container.

Dependencies

Description

  • This adds a minimal Postfix container to the stack.
    • The container will accept unauthenticated SMTP port 25 connections from containers inside the nodelocal and nodelocal-private networks, and relay them to a proper, authenticated external SMTP/TLS server for delivery.
  • The CakePHP container configuration now injects EMAIL_TRANSPORT_DEFAULT_URL to point to the Postfix container.

Notes

  • The relay does not do any complicated rewriting of e-mail headers (other than ensuring the basic full set exist), so it's important that internal e-mails (e.g. from CakePHP) are correctly-formed to be deliverable. Most importantly in practice, this means the "From:" address must be an address that the external SMTP server is willing to relay.
    • Testing with the no-reply@cdli.network SMTP account for the smtp.cdli.network mail server indicates that it is willing to relay e-mails from *@cdli.network. However, it would probably be best to keep From: no-reply@cdli.network or similar wherever appropriate for unmonitored e-mails. Additionally, when an automated e-mail is sent that may be replied to, the standard e-mail Reply-To: header can be used.
    • In any case, we should ensure that the external SMTP account is able to relay e-mails from *@cdli.network and that the From: header is always set to an address from that domain.
  • The Postfix SMTP server, optional port, username, and password are all currently configured by environment variable (or env-file).
    • The .env.examples file in !1072 (merged) contains these fields with some explanation.
    • If the environment variables are missing, Docker Compose will show the warning below when launching (and the Postfix container may fail to start with an error, which may in turn cause send functions in CakePHP to throw errors since it can't connect):
WARN[0000] The "CDLI_POSTFIX_SMTP_SERVER" variable is not set. Defaulting to a blank string.
WARN[0000] The "CDLI_POSTFIX_SMTP_USERNAME" variable is not set. Defaulting to a blank string.
WARN[0000] The "CDLI_POSTFIX_SMTP_PASSWORD" variable is not set. Defaulting to a blank string.
Edited by Tim Bellefleur

Merge request reports

Loading