http://www.debianhelp.co.uk/eximtips.htm
root@linuxdeb:/etc/exim4# cat update-exim4.conf.conf # /etc/exim4/update-exim4.conf.conf # # Edit this file and /etc/mailname by hand and execute update-exim4.conf # yourself or use 'dpkg-reconfigure exim4-config' # # Please note that this is _not_ a dpkg-conffile and that automatic changes # to this file might happen. The code handling this will honor your local # changes, so this is usually fine, but will break local schemes that mess # around with multiple versions of the file. # # update-exim4.conf uses this file to determine variable values to generate # exim configuration macros for the configuration file. # # Most settings found in here do have corresponding questions in the # Debconf configuration, but not all of them. # # This is a Debian specific file dc_eximconfig_configtype='smarthost' dc_other_hostnames='linuxdeb.maildomain.org' #dc_local_interfaces='127.0.0.1 ; ::1' dc_local_interfaces='127.0.0.1' dc_readhost='' dc_relay_domains='' dc_minimaldns='false' dc_relay_nets='' dc_smarthost='mailgw.mydomain.lu' CFILEMODE='644' dc_use_split_config='false' dc_hide_mailname='false' dc_mailname_in_oh='true' dc_localdelivery='mail_spool' root@linuxdeb:/etc/exim4# update-exim4.conf
If you change the template located in /etc/exim, then reload the file : update-exim4.conf.template
As Exim is only use as client in our example, then we can stop the service exim which is used only for SMTP relay.
Now test your config:
root@linuxdeb:/etc/exim4# sendmail -v mymail@maildomain.org < /etc/motd LOG: MAIN <= linuxdeb.maildomain.org U=root P=local S=622 delivering 1XhgnJ-0008RI-Qu R: smarthost for mymail@maildomain.org T: remote_smtp_smarthost for mymail@maildomain.org Connecting to mailgw.mydomain.lu [10.1.1.22]:25 ... connected SMTP<< 220 mailgw.mydomain.lu ESMTP Exim 4.69 Fri, 24 Oct 2014 17:28:49 +0200 SMTP>> EHLO linuxdeb.maildomain.org SMTP<< 250-mailgw.mydomain.lu Hello linuxdeb.maildomain.org [192.18.20.77] 250-SIZE 104857600 250-PIPELINING 250-AUTH LOGIN 250 HELP SMTP>> MAIL FROM:<linuxdeb.maildomain.org> SIZE=1658 SMTP>> RCPT TO:<mymail@maildomain.org> SMTP>> DATA SMTP<< 250 OK SMTP<< 250 Accepted SMTP<< 354 Enter message, ending with "." on a line by itself SMTP>> writing message and terminating "." SMTP<< 250 OK id=1XhgnJ-0006wE-S6 SMTP>> QUIT LOG: MAIN => mymail@maildomain.org R=smarthost T=remote_smtp_smarthost H=mailgw.mydomain.lu [10.1.1.22] LOG: MAIN Completed
Now you can configure the aliases, so all mails will be redirected to your mailbox
root@linuxdeb:/etc/exim4# cat /etc/aliases # /etc/aliases 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: mymail@maildomain.org root@linuxdeb:/etc/exim4# sendmail -bi
Check errors in /var/log/exim4/mainlog or rejectlog
root@linuxdeb:/etc/exim4# cat /var/log/exim4/mainlog
To check an Exim config file:
exim -C <config_file> -bV