Quick test if mailx is installed:
echo "test" | mail -s "test" user@example.com
Check if exim4 is installed (or if not, if another mail system is installed!)
Use dpkg to do the configuration:
dpkg-reconfigure exim4-config
Choices here are:
Choose the second option (mail sent by smarthost; received via SMTP or fetchmail). Note that if you choose the third (no local mail) the system tries to send local mail (to root etc.) via the external server, which of course doesn't know about the system and complains…
Leave as default (i.e. the system FDQN)
Leave as default - normally
127.0.0.1 ; ::1
as we are not accepting mail from anywhere else
Leave as default (i.e. the system FDQN)
Leave as default (nothing)
The external mail server address
Normally don't bother with this
Normally no.
Normally default (mbox format in /var/mail/)
Normally no
On a standard Debian setup the /etc/aliases looks something like this:
mailer-daemon: postmaster postmaster: root nobody: root hostmaster: root usenet: root news: root webmaster: root www: root ftp: root abuse: root noc: root security: root root: someuser
where someuser is the user you set up as the non-root user with sudo privileges (unless root can log in directly). Change the someuser entry to the desired external address:
root: user@example.com
This isn't necessary for exim, but is for postfix and sendmail. Run:
newaliases
to generate the aliases database (normally /etc/mail/aliases.db)