# Deployment instructions - turning mail on for a host For whoever manages the host (Pi-Main). Do this per host and per environment; credentials never go into the repository, a chat or a ticket. ## Before you start - The release containing the mail feature is already deployed (a host without mail settings behaves exactly as before). - You have: the SMTP host and port, the account (username, password) that may send as the chosen sender address, the public https address of the site (no path). ## Steps 1. Open the host's environment file (Pi: `~/apps///shared/env`, mode 600). 2. Add, in one go (the order inside the file does not matter, but set `App__PublicBaseUrl` together with the host or the host starts with mail off): - `App__PublicBaseUrl=https://` - `Email__Smtp__Host=`, `Email__Smtp__Port=587`, `Email__Smtp__EnableSsl=true` - `Email__Smtp__Username=`, `Email__Smtp__Password=` - ASF: `Email__FromAddress=no-reply@andreaslop.nl`, `Email__AllowedFromAddresses__0=no-reply@andreaslop.nl`, `Email__FromName=Andrea Slop Fotografie` (SlpSoftware: nothing more is needed) 3. Restart the unit (Pi: `systemctl --user restart `). 4. Read the journal (Pi: `journalctl --user -u -n 50`): - success: a line `mail_status enabled=true smtp_host=... starttls=true default_from_domain=...`; - a line `mail_configuration_invalid ... ` (Error): mail stays OFF, the site runs; fix the named settings and restart. 5. `curl https:///api/v1/System/capabilities` shows `"emailEnabled":true`. 6. Real test (Bryan): in the admin invite a mailbox of yours (Gmail and Outlook, see the readiness checklist); the dialog says "mail sent" or names the reason. Also try "Wachtwoord vergeten?" on the login page. 7. If a mail is refused, the journal line `identity_mail_failed code=... detail=... phase=... timings=...` tells what happened (`rejected_sender`: the account may not send as that address; `auth_failed`: wrong credentials; `tls_failed`: STARTTLS problem; `timeout_*`: slow or blocked server). Settings to change: see the infrastructure design. ## Changing or removing mail later Edit the same file and restart. To switch mail off: delete `Email__Smtp__Host` (the copy-link flow keeps working) and restart.