matrix-docker-ansible-deploy/docs/configuring-playbook-email.md
Suguru Hirahara 235f11fede
Update docs/configuring-playbook-email.md: add an instruction to disable mail service
Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>
2025-02-20 01:04:32 +09:00

3.4 KiB

Adjusting email-sending settings (optional)

By default, this playbook sets up an Exim relay SMTP mailer service (powered by exim-relay and the ansible-role-exim-relay Ansible role), through which all Matrix services send emails.

With the default setting, exim-relay attempts to deliver emails directly with the address matrix@matrix.example.com, as specified by the exim_relay_sender_address playbook variable. See below if you want to configure the playbook to relay email through another SMTP server.

The Ansible role for exim-relay is developed and maintained by the MASH (mother-of-all-self-hosting) project. For details about configuring exim-relay, you can check them via:

Firewall settings

No matter whether you send email directly (the default) or you relay email through another host, you'll probably need to allow outgoing traffic for TCP ports 25/587 (depending on configuration).

Docker automatically opens these ports in the server's firewall, so you likely don't need to do anything. If you use another firewall in front of the server, you may need to adjust it.

Adjusting the playbook configuration

Relaying email through another SMTP server (optional)

By default, exim-relay attempts to deliver emails directly. This may or may not work, depending on your domain configuration (SPF settings, etc.)

On some cloud providers such as Google Cloud, port 25 is always blocked, so sending email directly from your server is not possible. In this case, you will need to relay email through another SMTP server.

For details about configuration, refer this section on the role's document.

💡 To improve deliverability, we recommend relaying email through another SMTP server anyway.

Disable mail service (optional)

For a low-power server you might probably want to disable exim-relay. To do so, add the following configuration to your inventory/host_vars/matrix.example.com/vars.yml file:

exim_relay_enabled: false

Note that disabling exim-relay will stop email-notifications and other similar functions from working.

See this entry on the FAQ for other possible optimizations for a low-power server.

Troubleshooting

See this section on the role's documentation for details.