User Tools

Site Tools


computing:mailclient

This is an old revision of the document!


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='haacksnetworking.org'
dc_relay_domains=''
dc_minimaldns='false'
dc_hide_mailname='true'
#just in case
dc_localdelivery='notifications@haacksnetworking.org'

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

#setup headers
sudo nano /etc/email-addresses
sexa: remote@haacksnetworking.org
root: remote@haacksnetworking.org
*: remote@haacksnetworking.org

#calm tls
sudo nano /etc/exim4/exim4.conf.localmacros
MAIN_TLS_ADVERTISE_HOSTS =
REMOTE_SMTP_SMARTHOST_HOSTS_REQUIRE_TLS = *
MAIN_HARDCODE_PRIMARY_HOSTNAME = domain.com
MAIN_LOCAL_DOMAINS =
#disable_ipv6=true #if needed

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='haacksnetworking.org'
dc_relay_domains=''
dc_minimaldns='false'
dc_hide_mailname='true'
dc_localdelivery='notifications@haacksnetworking.org'
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

sudo cat << EOF > /etc/email-addresses
sexa: remote@haacksnetworking.org
root: remote@haacksnetworking.org
*: remote@haacksnetworking.org
EOF

cat << 'EOF' | sudo tee /etc/exim4/exim4.conf.localmacros
MAIN_TLS_ADVERTISE_HOSTS =
REMOTE_SMTP_SMARTHOST_HOSTS_REQUIRE_TLS = *
MAIN_HARDCODE_PRIMARY_HOSTNAME = domain.com
MAIN_LOCAL_DOMAINS =
#disable_ipv6=true #if needed
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'

We turned off local delivery above so now all we need to do is set the hostname and mailname to domain.com:

echo "haacksnetworking.org" | sudo tee /etc/mailname
echo "haacksnetworking.org" | sudo tee /etc/hostname

Then, in /etc/hosts enter something like:

127.0.1.1       domain.com    domain

Send a few test emails to external domains (external to mail server) and to local users (local on the client):

echo "Satellite test $(date)" | mail -s "Normal satellite test 7" root
echo "Satellite test $(date)" | mail -s "Normal satellite test 7" oemb1905@gmail.com

Both will work … and here's how and why.

oemb1905 2026/04/08 16:04

computing/mailclient.1775675932.txt.gz · Last modified: by oemb1905