Add Postfix SMTP relay container.
Dependencies
- Unblocks !1068
- Depends on !1072 (merged)
Description
- This adds a minimal Postfix container to the stack.
- The container will accept unauthenticated SMTP port 25 connections from containers inside the
nodelocalandnodelocal-privatenetworks, and relay them to a proper, authenticated external SMTP/TLS server for delivery.
- The container will accept unauthenticated SMTP port 25 connections from containers inside the
- The CakePHP container configuration now injects
EMAIL_TRANSPORT_DEFAULT_URLto 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.networkSMTP account for thesmtp.cdli.networkmail server indicates that it is willing to relay e-mails from*@cdli.network. However, it would probably be best to keepFrom: no-reply@cdli.networkor similar wherever appropriate for unmonitored e-mails. Additionally, when an automated e-mail is sent that may be replied to, the standard e-mailReply-To:header can be used. - In any case, we should ensure that the external SMTP account is able to relay e-mails from
*@cdli.networkand that theFrom:header is always set to an address from that domain.
- Testing with the
- The Postfix SMTP server, optional port, username, and password are all currently configured by environment variable (or env-file).
- The
.env.examplesfile 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):
- The
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