====== Configure linux to send email to external addresses ====== ===== Debian ===== Quick test if mailx is installed: echo "test" | mail -s "test" user@example.com ==== exim4 ==== Check if exim4 is installed (or if not, if another mail system is installed!) Use dpkg to do the configuration: dpkg-reconfigure exim4-config === General type of mail configuration: === Choices here are: * internet site; mail is sent and received directly using SMTP * mail sent by smarthost; received via SMTP or fetchmail * mail sent by smarthost; no local mail * local delivery only; not on a network * no configuration at this time 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... === Mail name === Leave as default (i.e. the system FDQN) === IP-addresses to listen on for incoming SMTP connections: === Leave as default - normally 127.0.0.1 ; ::1 as we are not accepting mail from anywhere else === Other destinations for which mail is accepted: === Leave as default (i.e. the system FDQN) === Machines to relay mail for: === Leave as default (nothing) === IP address or host name of the outgoing smarthost: === The external mail server address === Hide local mail name in outgoing mail? === Normally don't bother with this === Keep number of DNS-queries minimal (Dial-on-Demand)? === Normally no. === Delivery method for local mail: === Normally default (mbox format in /var/mail/) === Split configuration into small files? === Normally no ==== Diverting root mail to another address ==== 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 === Regenerating aliases database === This isn't necessary for exim, but is for postfix and sendmail. Run: newaliases to generate the aliases database (normally /etc/mail/aliases.db)