Setting up Outgoing Email
Sending emails from your DOM server requires setting up a mail relay on the same server that listens on localhost port 25. This is due to the sandbox environment that prevents the application from accessing your local network.
This applies to v23.6 and later.
Configuring Smarthost Relay
This guide will take you trough the process of setting up the Exim4 MTA included in Ubuntu for relaying email to your own on-premise or cloud email server.
NOTE: You can use another MTA of choice, as long as it listens on 127.0.0.1:25
and relays emails from localhost.
Install Exim4
Install Exim4 by running the following commands on your Ubuntu server:
apt update
apt install exim4
Configure Relaying
Open /etc/exim4/update-exim4.conf.conf
in an text editor.
Find the line that starts with dc_eximconfig_configtype=
and change its
value to smarthost
. For example:
dc_eximconfig_configtype='smarthost'
Find the line starting with dc_smarthost=
and enter the address and port of
the SMTP server you want to relay emails via. For example:
dc_smarthost='smtp.example.com::587'
Replace smtp.example.com
with the hostname or IP address of your SMTP server,
and 587
with the appropriate port number.
If your SMTP server requires authentication, edit /etc/exim4/passwd.client
and add a single line containing the credentials. For example:
smtp.example.com:username:password
Apply and Test
After making the necessary changes to the configuration files, update the Exim4 configuration by running the following commands:
update-exim4.conf
systemctl restart exim4
To test if Exim4 is relaying emails correctly, use the following command:
echo "This is a test" | mail -s "Test Email" recipient@example.com
Replace recipient@example.com
with the email address where you want to send
the test email. Check the recipient’s mailbox to verify if the test email was
successfully sent.
Enable Email Feature in dom-server.conf
Open the dom-server configuration file /etc/dom-server/dom-server.conf
in a
text editor, create the file if it doesn’t exist.
Enable email features by setting enabled=1
, and configuring a default from
address in the [mail]
section of the file. For example:
[mail]
enabled = 1
default_from = DOM Server <dom-server@example.com>
After making the required changes in the configuration file, run the following command to restart the application.
systemctl restart dom-server