Set ansible variables for postfix_queue role.
When external SMTP host is defined in settings, populate POSTFIX_QUEUE_*
ansible vars when provisioning app servers.
In addition to merely passing the SMTP server settings to postfix, we also set it up to rewrite the sender address to use a fixed domain defined in the settings, that has been pre-validated and authorized as a sending domain in AuthSMTP. The local part of the rewritten address (part before @) is the instance domain, so the rewritten From address looks something like:
pr123.opencraft.hosting@opencraft.hosting
or when using external LMS domain:
courses.mydomain.com@opencraft.hosting
The original sender address is copied into the Reply-To
header.
Testing
Add the following settings to your .env
file (replace username and password with valid values):
INSTANCE_SMTP_RELAY_HOST='mail.authsmtp.com'
INSTANCE_SMTP_RELAY_PORT=587
INSTANCE_SMTP_RELAY_USERNAME='xxx'
INSTANCE_SMTP_RELAY_PASSWORD='xxx'
INSTANCE_SMTP_RELAY_SENDER_DOMAIN='plebia.org'
I'm using plebia.org
as the sender domain because it has already been validated in our AuthSMTP account.
Restart the IM and provision a new instance. The configuration playbook you will be using should include the postfix_queue role. I've been using this one: https://github.com/open-craft/configuration/blob/stgallen/playbooks/edx_sandbox.yml
Check that combined vars include the POSTFIX_QUEUE_*
variables set to expected values.
When the instance finishes provisioning, sign up in the LMS to receive the activation email. The email should come from a @plebia.org
email address, but if you hit "reply to", it should reploy to the original instance's email setting (as defined by instance.email
).