Sending System Email Through Another Server
This should only be done if the server is not an email server. This will allow system emails to be sent through the email address of another server. If you have not already done so, set up the email address you will be sending system emails through on the other server.
Exim
The next step is to add the other server’s public name, the email address and the password to a configuration file. Edit /etc/exim4/passwd.client and add the following line:
example.com:user.example.com:password123
Now edit /etc/exim4/update-exim4.conf.conf and change the following values where you replace example.com with the domain name you are sending your email through:
dc_eximconfig_configtype='smarthost' dc_smarthost='example.com::465' dc_hide_mailname='false'
Now edit /etc/maildomains and add this line:
example.com: root
Edit or create the file /etc/exim4/exim4.conf.localmacros and add the following lines:
MAIN_TLS_ENABLE = 1 REMOTE_SMTP_SMARTHOST_HOSTS_REQUIRE_TLS = * TLS_ON_CONNECT_PORTS = 465 REQUIRE_PROTOCOL = smtps
We also want to update email aliases on the server. Open the file /etc/aliases and change all the fields after the colons to the email address you are sending from. Leave the line for mailer-daemon/postmaster as-is since people are used to getting email bounce messages from that name. If there is not a line starts with root:
then add one with the same sending email address in this format:
root: user@example.com
We also need to set this up in a second file. Open the file /etc/email-addresses and add this line:
root:user@example.com
Now run the following command to apply our changes to exim.
cd /etc/exim4 update-exim4.conf service exim4 reload service exim4 restart
LFD
Now lets set LFD to use the email address we just set up in Exim. Edit /etc/csf/csf.conf and set the following values:
LF_ALERT_TO = "reciever@example.com"
LF_ALERT_FROM = "sender@example.com"
Now we need to reload and restart LFD to apply the change by running these commands:
lfd -r service lfd restart