
My goal is to have the system’s MTA (exim4) forward any emails sent on the local host to a remote mail server for distribution. No mail will be received locally on this host, all mail will be forwarded elsewhere.
Ubuntu uses the command dpgk-reconfigure exim4-config
to generate the exim4 configuration file /var/lib/exim4/config.autogenerated
. Two additional files must be created to complete the configuration.
- Create
/etc/exim4/exim4.conf.localmacros
containing the line:MAIN_LOCAL_DOMAINS =
This will force exim4 to send all mail to the remote mail server and not to try to delivery anything locally. - Edit
/etc/exim4/passwd.client
and add a line containing the SMTP login used to access the remote mail server:*:userid:password
Beware that special characters in the userid or password can cause problems. - Run
dpgk-reconfigure exim4-config
- General type of mail configuration: mail sent by smarthost; no local mail
- System mail name: your_hostname.com
- IP-address to listen on for incoming SMTP connections:127.0.0.1 ; ::1
- Other destinations for which mail is accepted: leave this blank
- Visible domain name for local users: your_hostname.com
- IP address or host name of the outgoing smarthost: mail.server.com::587
- Keep number of DNS-queries minimal (Dial-on-Demand)? No
- Split configuration file into small files? No
- Restart exim4:
systemctl restart exim4