Use this for personal machines behind someone else's LAN. It turns exim into a MUA instead of a MTA. That is, tt uses your remote self-hosted smtp instead of sending directly.
sudo apt install exim4
sudo nano /etc/exim4/update-exim4.conf.conf
dc_eximconfig_configtype='smarthost'
dc_smarthost='mail.domain.com::587'
dc_local_interfaces='127.0.0.1 ; ::1'
dc_other_hostnames=''
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_hide_mailname='true'
sudo nano /etc/exim4/passwd.client
mail.domain.com:user:password
*:user:password
sudo chown root:Debian-exim /etc/exim4/passwd.client
sudo chmod 640 /etc/exim4/passwd.client
#calm tls
sudo nano /etc/exim4/exim4.conf.localmacros
MAIN_TLS_ADVERTISE_HOSTS =
REMOTE_SMTP_SMARTHOST_HOSTS_REQUIRE_TLS = *
MAIN_HARDCODE_PRIMARY_HOSTNAME = user.domain.com
MAIN_LOCAL_DOMAINS =
sudo update-exim4.conf
sudo systemctl restart exim4
echo "Test after permission fix" | mail -s "Exim4 test 2" oemb1905@jonathanhaack.com
sudo tail -f /var/log/exim4/mainlog
Here's a copy pastable version:
sudo apt install exim4
cat << 'EOF' | sudo tee /etc/exim4/update-exim4.conf.conf
dc_eximconfig_configtype='smarthost'
dc_smarthost='mail.domain.com::587'
dc_local_interfaces='127.0.0.1 ; ::1'
dc_other_hostnames=''
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_hide_mailname='true'
EOF
cat << 'EOF' | sudo tee /etc/exim4/passwd.client
mail.domain.com:user:password
*:user:password
EOF
sudo chown root:Debian-exim /etc/exim4/passwd.client
sudo chmod 640 /etc/exim4/passwd.client
cat << 'EOF' | sudo tee /etc/exim4/exim4.conf.localmacros
MAIN_TLS_ADVERTISE_HOSTS =
REMOTE_SMTP_SMARTHOST_HOSTS_REQUIRE_TLS = *
MAIN_HARDCODE_PRIMARY_HOSTNAME = user.domain.com
MAIN_LOCAL_DOMAINS =
EOF
sudo update-exim4.conf
sudo systemctl restart exim4
echo "Exim4 configured and restarted."
echo "Test with:"
echo 'echo "Test from $(hostname)" | mail -s "Exim4 test from $(hostname)" test@gmail.com'
--- //[[alerts@haacksnetworking.org|oemb1905]] 2026/03/29 15:33//